|
|
@ -83,7 +83,7 @@ class ListChecksTestCase(BaseTestCase): |
|
|
|
self.assertContains(r, "Alice") |
|
|
|
|
|
|
|
def test_it_works_with_tags_param(self): |
|
|
|
r = self.client.get("/api/v1/checks/?tags=a2-tag", HTTP_X_API_KEY="abc") |
|
|
|
r = self.client.get("/api/v1/checks/?tag=a2-tag", HTTP_X_API_KEY="abc") |
|
|
|
self.assertEqual(r.status_code, 200) |
|
|
|
|
|
|
|
doc = r.json() |
|
|
@ -96,7 +96,7 @@ class ListChecksTestCase(BaseTestCase): |
|
|
|
self.assertEqual(check["tags"], "a2-tag") |
|
|
|
|
|
|
|
def test_it_filters_with_multiple_tags_param(self): |
|
|
|
r = self.client.get("/api/v1/checks/?tags=a1-tag&tags=a1-additional-tag", HTTP_X_API_KEY="abc") |
|
|
|
r = self.client.get("/api/v1/checks/?tag=a1-tag&tag=a1-additional-tag", HTTP_X_API_KEY="abc") |
|
|
|
self.assertEqual(r.status_code, 200) |
|
|
|
|
|
|
|
doc = r.json() |
|
|
@ -108,8 +108,16 @@ class ListChecksTestCase(BaseTestCase): |
|
|
|
self.assertEqual(check["name"], "Alice 1") |
|
|
|
self.assertEqual(check["tags"], "a1-tag a1-additional-tag") |
|
|
|
|
|
|
|
def test_it_does_not_match_tag_partially(self): |
|
|
|
r = self.client.get("/api/v1/checks/?tag=tag", HTTP_X_API_KEY="abc") |
|
|
|
self.assertEqual(r.status_code, 200) |
|
|
|
|
|
|
|
doc = r.json() |
|
|
|
self.assertTrue("checks" in doc) |
|
|
|
self.assertEqual(len(doc["checks"]), 0) |
|
|
|
|
|
|
|
def test_non_existing_tags_filter_returns_empty_result(self): |
|
|
|
r = self.client.get("/api/v1/checks/?tags=non_existing_tag_with_no_checks", HTTP_X_API_KEY="abc") |
|
|
|
r = self.client.get("/api/v1/checks/?tag=non_existing_tag_with_no_checks", HTTP_X_API_KEY="abc") |
|
|
|
self.assertEqual(r.status_code, 200) |
|
|
|
|
|
|
|
doc = r.json() |
|
|
|