!11 Fix testsuite for werkzeug 1.x

From: @hht8
Reviewed-by: @yangzhao_kl
Signed-off-by: @yangzhao_kl
This commit is contained in:
openeuler-ci-bot 2021-08-19 09:49:00 +00:00 committed by Gitee
commit 7ac11b721f
6 changed files with 57 additions and 12 deletions

View File

@ -11,8 +11,8 @@ Closes #681
diff --git a/flask_restful/reqparse.py b/flask_restful/reqparse.py
index 8fe142e..527bc94 100644
--- flask_restful/reqparse.py
+++ flask_restful/reqparse.py
--- a/flask_restful/reqparse.py
+++ b/flask_restful/reqparse.py
@@ -176,7 +176,7 @@ class Argument(object):
values = source.getlist(name)
else:
@ -24,8 +24,8 @@ index 8fe142e..527bc94 100644
for value in values:
diff --git a/tests/test_reqparse.py b/tests/test_reqparse.py
index ce9ce30..df18ead 100644
--- tests/test_reqparse.py
+++ tests/test_reqparse.py
--- a/tests/test_reqparse.py
+++ b/tests/test_reqparse.py
@@ -891,5 +891,30 @@ class ReqParseTestCase(unittest.TestCase):
self.assertEquals(args['int1'], 1)
self.assertEquals(args['int2'], 2)

View File

@ -9,8 +9,8 @@ Subject: [PATCH] Support aniso8601 >3.0 in tests
diff --git a/tests/test_inputs.py b/tests/test_inputs.py
index 90a2fb0..6cb9e9b 100644
--- tests/test_inputs.py
+++ tests/test_inputs.py
--- a/tests/test_inputs.py
+++ b/tests/test_inputs.py
@@ -417,7 +417,7 @@ def test_bad_isointervals():
for bad_interval in bad_intervals:
yield (

View File

@ -14,8 +14,8 @@ Date: Tue Jun 26 12:06:37 2018 +0200
diff --git tests/test_api.py tests/test_api.py
index 26447ae..f34b3f6 100644
--- tests/test_api.py
+++ tests/test_api.py
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -784,7 +784,7 @@ class APITestCase(unittest.TestCase):
allow = ', '.join(set(resp.headers.get_all('Allow')))
allow = set(method.strip() for method in allow.split(','))

View File

@ -0,0 +1,41 @@
From 73376a488907af3042b52678ac4c23f8a8911e5b Mon Sep 17 00:00:00 2001
From: Anthony Sottile <asottile@umich.edu>
Date: Fri, 7 Feb 2020 11:06:15 -0800
Subject: [PATCH] Fix testsuite for werkzeug 1.x (#862)
---
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

View File

@ -1,5 +1,5 @@
--- 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
--- a/tests/test_accept.py.orig 2015-11-13 12:06:18.914003153 +0100
+++ b/tests/test_accept.py 2015-11-13 12:04:42.786435117 +0100
@@ -121,26 +121,6 @@
assert_equals(res.content_type, 'text/plain')

View File

@ -1,6 +1,6 @@
Name: python-flask-restful
Version: 0.3.6
Release: 11
Release: 12
Summary: Framework for creating REST APIs
License: BSD
URL: https://www.github.com/flask-restful/flask-restful/
@ -9,6 +9,7 @@ Patch0: python-flask-restful.remove_q0_testcase.patch
Patch1: 0001-Fix-arguments-with-type-list-705.patch
Patch2: 0002-Support-aniso8601-3.0-in-tests.patch
Patch3: 0003-Fix-tests_api-list-traceback.patch
Patch4: Fix-testsuite-for-werkzeug-1.x.patch
BuildArch: noarch
BuildRequires: git gcc python3-setuptools python3-nose python3-mock python3-blinker
@ -27,7 +28,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
@ -45,6 +46,9 @@ rm -rf docs/_themes/.gitignore
%{python3_sitelib}/*
%changelog
* Tue Aug 17 2021 huanghaitao <huanghaitao8@huawei.com> - 0.3.6-12
- Fix testsuit for wekzeug 1.x
* Tue May 18 2020 Buildteam <buildteam@openeuler.org> - 0.3.6-11
- Remove redundant BuildRequires