healthchecks/hc/front/tests/test_add_prometheus.py
2021-01-29 15:05:42 +02:00

21 lines
766 B
Python

from django.test.utils import override_settings
from hc.test import BaseTestCase
class AddPrometheusTestCase(BaseTestCase):
def setUp(self):
super().setUp()
self.url = "/projects/%s/add_prometheus/" % self.project.code
def test_instructions_work(self):
self.client.login(username="alice@example.org", password="password")
r = self.client.get(self.url)
self.assertContains(r, "Prometheus")
self.assertContains(r, f"{self.project.code}/metrics/")
@override_settings(PROMETHEUS_ENABLED=False)
def test_it_handles_disabled_integration(self):
self.client.login(username="alice@example.org", password="password")
r = self.client.get(self.url)
self.assertEqual(r.status_code, 404)