test_issue_grouping.py 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. import uuid
  2. from django.shortcuts import reverse
  3. from model_bakery import baker
  4. from glitchtip.test_utils.test_case import GlitchTipTestCase
  5. from ..models import Issue
  6. class IssueGroupingTestCase(GlitchTipTestCase):
  7. def setUp(self):
  8. self.project = baker.make("projects.Project")
  9. self.projectkey = self.project.projectkey_set.first()
  10. self.params = f"?sentry_key={self.projectkey.public_key}"
  11. self.url = reverse("event_store", args=[self.project.id]) + self.params
  12. def test_fingerprint(self):
  13. data = {
  14. "exception": [
  15. {
  16. "type": "a",
  17. "value": "a",
  18. }
  19. ],
  20. "event_id": uuid.uuid4(),
  21. "fingerprint": ["foo"],
  22. }
  23. self.client.post(self.url, data, format="json")
  24. data["exception"][0]["type"] = "lol"
  25. data["event_id"] = uuid.uuid4()
  26. self.client.post(self.url, data, format="json")
  27. self.assertEqual(Issue.objects.count(), 1)