12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- from django.test.client import RequestFactory
- from fixtures.apidocs_test_case import APIDocsTestCase
- from sentry.testutils.helpers.datetime import before_now, iso_format
- class ProjectGroupEventBase(APIDocsTestCase):
- def setUp(self):
- first_release = {
- "firstEvent": before_now(minutes=3),
- "lastEvent": before_now(minutes=2, seconds=30),
- }
- last_release = {
- "firstEvent": before_now(minutes=1, seconds=30),
- "lastEvent": before_now(minutes=1),
- }
- for timestamp in first_release.values():
- self.create_event("a", release="1.0", timestamp=iso_format(timestamp))
- self.create_event("b", release="1.1")
- for timestamp in last_release.values():
- event = self.create_event("c", release="1.0a", timestamp=iso_format(timestamp))
- self.group_id = event.group.id
- self.login_as(user=self.user)
- class ProjectGroupEventsDocs(ProjectGroupEventBase):
- def setUp(self):
- super().setUp()
- self.url = f"/api/0/organizations/{self.organization.slug}/issues/{self.group_id}/events/"
- def test_get(self):
- response = self.client.get(self.url)
- request = RequestFactory().get(self.url)
- self.validate_schema(request, response)
- class ProjectGroupEventsLatestDocs(ProjectGroupEventBase):
- def setUp(self):
- super().setUp()
- self.url = (
- f"/api/0/organizations/{self.organization.slug}/issues/{self.group_id}/events/latest/"
- )
- def test_get(self):
- response = self.client.get(self.url)
- request = RequestFactory().get(self.url)
- self.validate_schema(request, response)
- class ProjectGroupEventsOldestDocs(ProjectGroupEventBase):
- def setUp(self):
- super().setUp()
- self.url = (
- f"/api/0/organizations/{self.organization.slug}/issues/{self.group_id}/events/oldest/"
- )
- def test_get(self):
- response = self.client.get(self.url)
- request = RequestFactory().get(self.url)
- self.validate_schema(request, response)
|