test_envelope_api.py 1002 B

1234567891011121314151617181920212223242526272829
  1. from django.shortcuts import reverse
  2. from apps.issue_events.models import IssueEvent
  3. from .utils import EventIngestTestCase
  4. class EnvelopeAPITestCase(EventIngestTestCase):
  5. """
  6. These test specifically test the envelope API and act more of integration test
  7. Use test_process_issue_events.py for testing Event Ingest more specifically
  8. """
  9. def setUp(self):
  10. super().setUp()
  11. self.url = reverse("api:event_envelope", args=[self.project.id]) + self.params
  12. self.small_event = self.get_json_data(
  13. "apps/event_ingest/tests/test_data/envelopes/django_message.json"
  14. )
  15. def test_envelope_api(self):
  16. with self.assertNumQueries(7):
  17. res = self.client.post(
  18. self.url, self.small_event, content_type="application/json"
  19. )
  20. self.assertContains(res, self.small_event[0]["event_id"])
  21. self.assertEqual(self.project.issues.count(), 1)
  22. self.assertEqual(IssueEvent.objects.count(), 1)