Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

Commit

Permalink
Add missing tests of app initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
leplatrem committed Sep 29, 2015
1 parent 3fb98e4 commit e8a2e21
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions cliquet/tests/resource/test_views_cors.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def test_present_on_unknown_url(self):
'Alert', 'Backoff', 'Retry-After', 'Content-Length'], status=404)


class CORSMaxAgeTest(BaseWebTest):
class CORSMaxAgeTest(BaseWebTest, unittest.TestCase):
def setUp(self):
super(CORSMaxAgeTest, self).setUp()
self.headers.update({
Expand All @@ -190,5 +190,16 @@ def setUp(self):
})

def test_cors_max_age_is_3600_seconds_by_default(self):
resp = self.app.options('/', headers=self.headers)
app = self.get_test_app()
resp = app.options('/', headers=self.headers)
self.assertEqual(int(resp.headers['Access-Control-Max-Age']), 3600)

def test_cors_max_age_can_be_specified_in_settings(self):
app = self.get_test_app({'cliquet.cors_max_age': '42'})
resp = app.options('/', headers=self.headers)
self.assertEqual(int(resp.headers['Access-Control-Max-Age']), 42)

def test_cors_max_age_is_disabled_if_unset(self):
app = self.get_test_app({'cliquet.cors_max_age': ''})
resp = app.options('/', headers=self.headers)
self.assertNotIn('Access-Control-Max-Age', resp.headers)

0 comments on commit e8a2e21

Please sign in to comment.