Skip to content

Commit

Permalink
Adjusted unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcottner committed Nov 21, 2024
1 parent 7221222 commit e955263
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/core/resource/test_views_cors.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,16 @@ def test_present_on_deletion(self):
response = self.app.delete(self.get_item_url(), headers=self.headers)
self.assertIn("Access-Control-Allow-Origin", response.headers)

def test_present_on_specified_domain(self):
with mock.patch.dict(
self.app.app.registry.settings, [("cors_origins", ["foo.bar", "notmyidea.org"])]
):
response = self.app.get("/unknown", headers=self.headers, status=404)
self.assertEqual(response.headers["Access-Control-Allow-Origin"], "notmyidea.org")

def test_present_on_unknown_url(self):
response = self.app.get("/unknown", headers=self.headers, status=404)
self.assertEqual(response.headers["Access-Control-Allow-Origin"], "notmyidea.org")
self.assertEqual(response.headers["Access-Control-Allow-Origin"], "*")

def test_not_present_on_unknown_url_if_setting_does_not_match(self):
with mock.patch.dict(self.app.app.registry.settings, [("cors_origins", "daybed.io")]):
Expand Down

0 comments on commit e955263

Please sign in to comment.