Merge "Port test_cornice to Python 3"
This commit is contained in:
commit
f621576b9f
@ -103,14 +103,14 @@ class WSMECorniceTestCase(unittest.TestCase):
|
|||||||
resp = self.app.get('/users')
|
resp = self.app.get('/users')
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
resp.body,
|
resp.body,
|
||||||
'[{"id": 1, "name": "first"}]'
|
b'[{"id": 1, "name": "first"}]'
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_get_xml_list(self):
|
def test_get_xml_list(self):
|
||||||
resp = self.app.get('/users', headers={"Accept": "text/xml"})
|
resp = self.app.get('/users', headers={"Accept": "text/xml"})
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
resp.body,
|
resp.body,
|
||||||
'<result><item><id>1</id><name>first</name></item></result>'
|
b'<result><item><id>1</id><name>first</name></item></result>'
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_post_json_data(self):
|
def test_post_json_data(self):
|
||||||
@ -121,7 +121,7 @@ class WSMECorniceTestCase(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
resp.body,
|
resp.body,
|
||||||
'{"id": 2, "name": "new"}'
|
b'{"id": 2, "name": "new"}'
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_post_xml_data(self):
|
def test_post_xml_data(self):
|
||||||
@ -132,7 +132,7 @@ class WSMECorniceTestCase(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
resp.body,
|
resp.body,
|
||||||
'<result><id>2</id><name>new</name></result>'
|
b'<result><id>2</id><name>new</name></result>'
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_pass_request(self):
|
def test_pass_request(self):
|
||||||
@ -170,7 +170,6 @@ class WSMECorniceTestCase(unittest.TestCase):
|
|||||||
headers={'Accept': 'application/json'},
|
headers={'Accept': 'application/json'},
|
||||||
expect_errors=True
|
expect_errors=True
|
||||||
)
|
)
|
||||||
print resp.body
|
|
||||||
self.assertEqual(resp.json['faultcode'], 'Client')
|
self.assertEqual(resp.json['faultcode'], 'Client')
|
||||||
self.assertEqual(resp.status_code, 400)
|
self.assertEqual(resp.status_code, 400)
|
||||||
|
|
||||||
@ -180,6 +179,5 @@ class WSMECorniceTestCase(unittest.TestCase):
|
|||||||
headers={'Accept': 'application/json'},
|
headers={'Accept': 'application/json'},
|
||||||
expect_errors=True
|
expect_errors=True
|
||||||
)
|
)
|
||||||
print resp.body
|
|
||||||
self.assertEqual(resp.json['faultcode'], 'Client')
|
self.assertEqual(resp.json['faultcode'], 'Client')
|
||||||
self.assertEqual(resp.status_code, 401)
|
self.assertEqual(resp.status_code, 401)
|
||||||
|
13
tox.ini
13
tox.ini
@ -1,5 +1,5 @@
|
|||||||
[tox]
|
[tox]
|
||||||
envlist = py27,py27-nolxml,pypy,tg11,tg15,cornice,coverage,py34,py34-nolxml,pecan-dev27,pecan-dev34,pep8
|
envlist = py27,py27-nolxml,pypy,tg11,tg15,cornice,cornice-py3,coverage,py34,py34-nolxml,pecan-dev27,pecan-dev34,pep8
|
||||||
|
|
||||||
[common]
|
[common]
|
||||||
testtools =
|
testtools =
|
||||||
@ -32,6 +32,17 @@ commands =
|
|||||||
{envbindir}/nosetests tests/test_cornice.py --with-xunit --xunit-file nosetests-{envname}.xml --verbose --with-coverage --cover-package wsmeext {posargs}
|
{envbindir}/nosetests tests/test_cornice.py --with-xunit --xunit-file nosetests-{envname}.xml --verbose --with-coverage --cover-package wsmeext {posargs}
|
||||||
{envbindir}/coverage xml -o coverage-{envname}.xml wsme/*.py wsmeext/cornice.py
|
{envbindir}/coverage xml -o coverage-{envname}.xml wsme/*.py wsmeext/cornice.py
|
||||||
|
|
||||||
|
[testenv:cornice-py3]
|
||||||
|
basepython = python3
|
||||||
|
usedevelop = {[testenv:cornice]usedevelop}
|
||||||
|
deps = {[testenv:cornice]deps}
|
||||||
|
# disable hash randomization
|
||||||
|
setenv =
|
||||||
|
PYTHONHASHSEED=0
|
||||||
|
commands =
|
||||||
|
{envbindir}/nosetests tests/test_cornice.py --with-xunit --xunit-file nosetests-{envname}.xml --verbose --with-coverage --cover-package wsmeext {posargs}
|
||||||
|
{envbindir}/coverage xml -o coverage-{envname}.xml wsme/*.py wsmeext/cornice.py
|
||||||
|
|
||||||
[testenv:pecan-dev-base]
|
[testenv:pecan-dev-base]
|
||||||
deps =
|
deps =
|
||||||
{[common]testtools}
|
{[common]testtools}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user