test_group_issue_details.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. class ProjectGroupIssueDetailsDocs(APIDocsTestCase):
  5. def setUp(self):
  6. self.create_release(project=self.project, version="abcdabc")
  7. first_release = {
  8. "firstEvent": before_now(minutes=3),
  9. "lastEvent": before_now(minutes=2, seconds=30),
  10. }
  11. last_release = {
  12. "firstEvent": before_now(minutes=1, seconds=30),
  13. "lastEvent": before_now(minutes=1),
  14. }
  15. for timestamp in first_release.values():
  16. self.create_event("a", release="1.0", timestamp=iso_format(timestamp))
  17. self.create_event("b", release="1.1")
  18. for timestamp in last_release.values():
  19. event = self.create_event("c", release="1.0a", timestamp=iso_format(timestamp))
  20. self.url = f"/api/0/organizations/{self.organization.slug}/issues/{event.group.id}/"
  21. self.login_as(user=self.user)
  22. def test_get(self):
  23. response = self.client.get(self.url)
  24. request = RequestFactory().get(self.url)
  25. self.validate_schema(request, response)
  26. def test_put(self):
  27. data = {"status": "resolved"}
  28. response = self.client.put(self.url, data)
  29. request = RequestFactory().put(self.url, data)
  30. self.validate_schema(request, response)
  31. def test_delete(self):
  32. response = self.client.delete(self.url)
  33. request = RequestFactory().delete(self.url)
  34. self.validate_schema(request, response)