tests.py 765 B

123456789101112131415161718192021222324
  1. from django.shortcuts import reverse
  2. from django.utils import timezone
  3. from model_bakery import baker
  4. from glitchtip.test_utils.test_case import GlitchTipTestCase
  5. class StatsV2APITestCase(GlitchTipTestCase):
  6. def setUp(self):
  7. self.create_user_and_project()
  8. self.url = reverse(
  9. "stats-v2", kwargs={"organization_slug": self.organization.slug}
  10. )
  11. def test_get(self):
  12. baker.make("events.Event", issue__project=self.project)
  13. start = timezone.now() - timezone.timedelta(hours=2)
  14. end = timezone.now()
  15. res = self.client.get(
  16. self.url,
  17. {"category": "error", "start": start, "end": end, "field": "sum(quantity)"},
  18. )
  19. self.assertEqual(res.status_code, 200)