You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
766 B

  1. from django.test.utils import override_settings
  2. from hc.test import BaseTestCase
  3. class AddPrometheusTestCase(BaseTestCase):
  4. def setUp(self):
  5. super().setUp()
  6. self.url = "/projects/%s/add_prometheus/" % self.project.code
  7. def test_instructions_work(self):
  8. self.client.login(username="[email protected]", password="password")
  9. r = self.client.get(self.url)
  10. self.assertContains(r, "Prometheus")
  11. self.assertContains(r, f"{self.project.code}/metrics/")
  12. @override_settings(PROMETHEUS_ENABLED=False)
  13. def test_it_handles_disabled_integration(self):
  14. self.client.login(username="[email protected]", password="password")
  15. r = self.client.get(self.url)
  16. self.assertEqual(r.status_code, 404)