tests.py 545 B

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