test_group_issue_details.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. from django.test.client import RequestFactory
  2. from fixtures.apidocs_test_case import APIDocsTestCase
  3. from sentry.testutils.helpers.datetime import before_now, iso_format
  4. from sentry.testutils.silo import region_silo_test
  5. @region_silo_test
  6. class ProjectGroupIssueDetailsDocs(APIDocsTestCase):
  7. def setUp(self):
  8. self.create_release(project=self.project, version="abcdabc")
  9. first_release = {
  10. "firstEvent": before_now(minutes=3),
  11. "lastEvent": before_now(minutes=2, seconds=30),
  12. }
  13. last_release = {
  14. "firstEvent": before_now(minutes=1, seconds=30),
  15. "lastEvent": before_now(minutes=1),
  16. }
  17. for timestamp in first_release.values():
  18. self.create_event("a", release="1.0", timestamp=iso_format(timestamp))
  19. self.create_event("b", release="1.1")
  20. for timestamp in last_release.values():
  21. event = self.create_event("c", release="1.0a", timestamp=iso_format(timestamp))
  22. self.url = f"/api/0/organizations/{self.organization.slug}/issues/{event.group.id}/"
  23. self.login_as(user=self.user)
  24. def test_get(self):
  25. response = self.client.get(self.url)
  26. request = RequestFactory().get(self.url)
  27. self.validate_schema(request, response)
  28. def test_put(self):
  29. data = {"status": "resolved"}
  30. response = self.client.put(self.url, data)
  31. request = RequestFactory().put(self.url, data)
  32. self.validate_schema(request, response)
  33. def test_delete(self):
  34. response = self.client.delete(self.url)
  35. request = RequestFactory().delete(self.url)
  36. self.validate_schema(request, response)