Skip to content

Commit

Permalink
Add tests for changing url_prefix after app init
Browse files Browse the repository at this point in the history
- tests sub-issue of pyeve#810
- After initializing the eve app, changing the url prefix should result
  in the resulting api urls changing accordingly.
  • Loading branch information
Davis Kirkendall committed Jan 17, 2016
1 parent c8d45ee commit 34ade40
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions eve/tests/methods/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,24 @@ def assertGet(self, response, status, resource=None):
etag = item.get(self.app.config['ETAG'])
self.assertTrue(etag is not None)

def test_url_prefix_config_negative(self):
"""Check that changing url prefix does not result in an unchanged api
URL.
"""
self.app.config['URL_PREFIX'] = 'api'
print(self.known_resource_url)
result = self.test_client.get(self.known_resource_url)
print(result)
self.assertNotEqual(result._status_code, 200)

def test_url_prefix_config(self):
"""Check that changing url prefix does results in a correctly changed
api url"""
self.app.config['URL_PREFIX'] = 'api'
print(self.known_resource_url)
result = self.test_client.get('/api' + self.known_resource_url)
self.assertEqual(result._status_code, 200)


class TestGetItem(TestBase):

Expand Down

0 comments on commit 34ade40

Please sign in to comment.