Fix testsuite for werkzeug 1.x
This commit is contained in:
parent
388e8e083c
commit
5faab7915e
41
backport-Fix-testsuite-for-werkzeug-1.x.patch
Normal file
41
backport-Fix-testsuite-for-werkzeug-1.x.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From 7437d53e12b08099586546f999fbdf3cf080330b Mon Sep 17 00:00:00 2001
|
||||
From: Anthony Sottile <asottile@umich.edu>
|
||||
Date: Fri, 7 Feb 2020 09:59:23 -0800
|
||||
Subject: [PATCH] Fix testsuite for werkzeug 1.x
|
||||
|
||||
---
|
||||
tests/test_api.py | 4 +++-
|
||||
tests/test_reqparse.py | 4 ++--
|
||||
2 files changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/tests/test_api.py b/tests/test_api.py
|
||||
index f7f8e661..6795d362 100644
|
||||
--- a/tests/test_api.py
|
||||
+++ b/tests/test_api.py
|
||||
@@ -445,7 +445,9 @@ def test_handle_non_api_error(self):
|
||||
|
||||
resp = app.get("/foo")
|
||||
self.assertEquals(resp.status_code, 404)
|
||||
- self.assertEquals('text/html', resp.headers['Content-Type'])
|
||||
+ # in newer versions of werkzeug this is `text/html; charset=utf8`
|
||||
+ content_type, _, _ = resp.headers['Content-Type'].partition(';')
|
||||
+ self.assertEquals('text/html', content_type)
|
||||
|
||||
def test_non_api_error_404_catchall(self):
|
||||
app = Flask(__name__)
|
||||
diff --git a/tests/test_reqparse.py b/tests/test_reqparse.py
|
||||
index 2f1fbedf..9776f17c 100644
|
||||
--- a/tests/test_reqparse.py
|
||||
+++ b/tests/test_reqparse.py
|
||||
@@ -2,9 +2,9 @@
|
||||
import unittest
|
||||
from mock import Mock, patch
|
||||
from flask import Flask
|
||||
-from werkzeug import exceptions, MultiDict
|
||||
+from werkzeug import exceptions
|
||||
from werkzeug.wrappers import Request
|
||||
-from werkzeug.datastructures import FileStorage
|
||||
+from werkzeug.datastructures import FileStorage, MultiDict
|
||||
from flask_restful.reqparse import Argument, RequestParser, Namespace
|
||||
import six
|
||||
import decimal
|
||||
@ -1,29 +0,0 @@
|
||||
--- tests/test_accept.py.orig 2015-11-13 12:06:18.914003153 +0100
|
||||
+++ tests/test_accept.py 2015-11-13 12:04:42.786435117 +0100
|
||||
@@ -121,26 +121,6 @@
|
||||
assert_equals(res.content_type, 'text/plain')
|
||||
|
||||
|
||||
- def test_accept_no_default_match_q0_not_acceptable(self):
|
||||
- """
|
||||
- q=0 should be considered NotAcceptable,
|
||||
- but this depends on werkzeug >= 1.0 which is not yet released
|
||||
- so this test is expected to fail until we depend on werkzeug >= 1.0
|
||||
- """
|
||||
- class Foo(flask_restful.Resource):
|
||||
- def get(self):
|
||||
- return "data"
|
||||
-
|
||||
- app = Flask(__name__)
|
||||
- api = flask_restful.Api(app, default_mediatype=None)
|
||||
-
|
||||
- api.add_resource(Foo, '/')
|
||||
-
|
||||
- with app.test_client() as client:
|
||||
- res = client.get('/', headers=[('Accept', 'application/json; q=0')])
|
||||
- assert_equals(res.status_code, 406)
|
||||
- assert_equals(res.content_type, 'application/json')
|
||||
-
|
||||
def test_accept_no_default_accept_highest_quality_of_two(self):
|
||||
class Foo(flask_restful.Resource):
|
||||
def get(self):
|
||||
@ -1,11 +1,12 @@
|
||||
Name: python-flask-restful
|
||||
Version: 0.3.8
|
||||
Release: 1
|
||||
Release: 2
|
||||
Summary: Framework for creating REST APIs
|
||||
License: BSD
|
||||
URL: https://www.github.com/flask-restful/flask-restful/
|
||||
Source0: https://github.com/flask-restful/flask-restful/archive/%{version}.tar.gz
|
||||
Patch0: python-flask-restful.remove_q0_testcase.patch
|
||||
|
||||
Patch6000: backport-Fix-testsuite-for-werkzeug-1.x.patch
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: git gcc python3-pytz python3-setuptools python3-nose python3-mock python3-blinker
|
||||
@ -24,7 +25,7 @@ Flask-RESTful is Python 3 extension for Flask that adds support
|
||||
for quickly building REST APIs.
|
||||
|
||||
%prep
|
||||
%autosetup -n flask-restful-%{version} -p0
|
||||
%autosetup -n flask-restful-%{version} -p1
|
||||
rm -rf docs/_themes/.gitignore
|
||||
|
||||
%build
|
||||
@ -42,6 +43,9 @@ rm -rf docs/_themes/.gitignore
|
||||
%{python3_sitelib}/*
|
||||
|
||||
%changelog
|
||||
* Thu Feb 18 2021 shixuantong <shixuantong@huawei.com> - 0.3.8-2
|
||||
- Fix testsuite for werkzeug 1.x
|
||||
|
||||
* Tue Feb 2 2021 liudabo <liudabo1@huawei.com> - 0.3.8-1
|
||||
- upgrade version to 0.3.8
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user