Skip to content

Commit

Permalink
Merge pull request Cornices#312 from tisdall/fix_test_basic_resource
Browse files Browse the repository at this point in the history
make test less dependent on pyramid version
  • Loading branch information
almet committed Jul 7, 2015
2 parents 297c6d0 + ea36f77 commit eff8f6f
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions cornice/tests/test_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,13 @@ def tearDown(self):
testing.tearDown()

def test_basic_resource(self):
from pkg_resources import parse_version, get_distribution
current_version = parse_version(get_distribution('pyramid').version)

self.assertEqual(self.app.get("/users").json, {'users': [1, 2]})

self.assertEqual(self.app.get("/users/1").json, {'name': 'gawel'})

resp = self.app.get("/users/1?callback=test")

if current_version < parse_version('1.5a4'):
self.assertEqual(resp.body, b'test({"name": "gawel"})', resp.body)
else:
self.assertEqual(resp.body, b'test({"name": "gawel"});', resp.body)
self.assertIn(b'test({"name": "gawel"})', resp.body, msg=resp.body)

def test_accept_headers(self):
# the accept headers should work even in case they're specified in a
Expand Down

0 comments on commit eff8f6f

Please sign in to comment.