tests.py 578 B

12345678910111213141516171819
  1. from django.shortcuts import reverse
  2. from rest_framework.test import APIClient
  3. from rest_framework.test import APITestCase
  4. from rest_framework import status
  5. from model_bakery import baker
  6. class ObservabilityAPITestCase(APITestCase):
  7. def setUp(self):
  8. self.client = APIClient()
  9. def test_get_metrics(self):
  10. self.user = baker.make("users.user", is_staff=True)
  11. self.client.force_login(self.user)
  12. url = reverse("prometheus-django-metrics")
  13. resp = self.client.get(url)
  14. self.assertEqual(resp.status_code, status.HTTP_200_OK)