|
|
@ -37,7 +37,13 @@ class ListChecksTestCase(BaseTestCase): |
|
|
|
return self.client.get("/api/v1/checks/", HTTP_X_API_KEY="X" * 32) |
|
|
|
|
|
|
|
def test_it_works(self): |
|
|
|
r = self.get() |
|
|
|
# Expect 3 queries: |
|
|
|
# * check API key |
|
|
|
# * retrieve checks |
|
|
|
# * retrieve channel codes |
|
|
|
with self.assertNumQueries(3): |
|
|
|
r = self.get() |
|
|
|
|
|
|
|
self.assertEqual(r.status_code, 200) |
|
|
|
self.assertEqual(r["Access-Control-Allow-Origin"], "*") |
|
|
|
|
|
|
@ -148,7 +154,10 @@ class ListChecksTestCase(BaseTestCase): |
|
|
|
self.project.api_key_readonly = "R" * 32 |
|
|
|
self.project.save() |
|
|
|
|
|
|
|
r = self.client.get("/api/v1/checks/", HTTP_X_API_KEY="R" * 32) |
|
|
|
# Expect a query to check the API key, and a query to retrieve checks |
|
|
|
with self.assertNumQueries(2): |
|
|
|
r = self.client.get("/api/v1/checks/", HTTP_X_API_KEY="R" * 32) |
|
|
|
|
|
|
|
self.assertEqual(r.status_code, 200) |
|
|
|
|
|
|
|
# When using readonly keys, the ping URLs should not be exposed: |
|
|
|