|
@@ -6,9 +6,9 @@ from sentry.testutils.helpers.datetime import iso_format, before_now
|
|
|
from sentry.models import Group
|
|
|
|
|
|
|
|
|
-class OrganizationEventDetailsTestBase(APITestCase, SnubaTestCase):
|
|
|
+class OrganizationEventDetailsEndpointTest(APITestCase, SnubaTestCase):
|
|
|
def setUp(self):
|
|
|
- super(OrganizationEventDetailsTestBase, self).setUp()
|
|
|
+ super(OrganizationEventDetailsEndpointTest, self).setUp()
|
|
|
min_ago = iso_format(before_now(minutes=1))
|
|
|
two_min_ago = iso_format(before_now(minutes=2))
|
|
|
three_min_ago = iso_format(before_now(minutes=3))
|
|
@@ -45,8 +45,6 @@ class OrganizationEventDetailsTestBase(APITestCase, SnubaTestCase):
|
|
|
)
|
|
|
self.groups = list(Group.objects.all().order_by("id"))
|
|
|
|
|
|
-
|
|
|
-class OrganizationEventDetailsEndpointTest(OrganizationEventDetailsTestBase):
|
|
|
def test_simple(self):
|
|
|
url = reverse(
|
|
|
"sentry-api-0-organization-event-details",
|
|
@@ -219,115 +217,3 @@ class OrganizationEventDetailsEndpointTest(OrganizationEventDetailsTestBase):
|
|
|
assert response.data["oldestEventID"] is None, "no older matching events"
|
|
|
assert response.data["nextEventID"] == "2" * 32, "2 is older and has matching tags "
|
|
|
assert response.data["latestEventID"] == "2" * 32, "2 is oldest matching message"
|
|
|
-
|
|
|
-
|
|
|
-class OrganizationEventDetailsLatestEndpointTest(OrganizationEventDetailsTestBase):
|
|
|
- def test_simple(self):
|
|
|
- url = reverse(
|
|
|
- "sentry-api-0-organization-event-details-latest",
|
|
|
- kwargs={"organization_slug": self.project.organization.slug},
|
|
|
- )
|
|
|
-
|
|
|
- with self.feature("organizations:events-v2"):
|
|
|
- response = self.client.get(url, format="json")
|
|
|
-
|
|
|
- assert response.status_code == 200, response.content
|
|
|
- assert response.data["id"] == "c" * 32
|
|
|
- assert response.data["previousEventID"] == "b" * 32
|
|
|
- assert response.data["nextEventID"] is None
|
|
|
- assert response.data["projectSlug"] == self.project.slug
|
|
|
-
|
|
|
- def test_no_access(self):
|
|
|
- url = reverse(
|
|
|
- "sentry-api-0-organization-event-details-latest",
|
|
|
- kwargs={"organization_slug": self.project.organization.slug},
|
|
|
- )
|
|
|
-
|
|
|
- response = self.client.get(url, format="json")
|
|
|
-
|
|
|
- assert response.status_code == 404, response.content
|
|
|
-
|
|
|
- def test_no_event(self):
|
|
|
- new_org = self.create_organization(owner=self.user)
|
|
|
- self.create_project(organization=new_org)
|
|
|
- url = reverse(
|
|
|
- "sentry-api-0-organization-event-details-latest",
|
|
|
- kwargs={"organization_slug": new_org.slug},
|
|
|
- )
|
|
|
-
|
|
|
- with self.feature("organizations:events-v2"):
|
|
|
- response = self.client.get(url, format="json")
|
|
|
-
|
|
|
- assert response.status_code == 404, response.content
|
|
|
-
|
|
|
- def test_query_with_issue_id(self):
|
|
|
- url = reverse(
|
|
|
- "sentry-api-0-organization-event-details-latest",
|
|
|
- kwargs={"organization_slug": self.project.organization.slug},
|
|
|
- )
|
|
|
- query = {"query": "issue.id:{}".format(self.groups[1].id)}
|
|
|
-
|
|
|
- with self.feature("organizations:events-v2"):
|
|
|
- response = self.client.get(url, query, format="json")
|
|
|
-
|
|
|
- assert response.status_code == 200, response.content
|
|
|
- assert response.data["id"] == "c" * 32
|
|
|
- assert response.data["previousEventID"] is None
|
|
|
- assert response.data["nextEventID"] is None
|
|
|
- assert response.data["projectSlug"] == self.project.slug
|
|
|
-
|
|
|
-
|
|
|
-class OrganizationEventDetailsOldestEndpointTest(OrganizationEventDetailsTestBase):
|
|
|
- def test_simple(self):
|
|
|
- url = reverse(
|
|
|
- "sentry-api-0-organization-event-details-oldest",
|
|
|
- kwargs={"organization_slug": self.project.organization.slug},
|
|
|
- )
|
|
|
-
|
|
|
- with self.feature("organizations:events-v2"):
|
|
|
- response = self.client.get(url, format="json")
|
|
|
-
|
|
|
- assert response.status_code == 200, response.content
|
|
|
- assert response.data["id"] == "a" * 32
|
|
|
- assert response.data["previousEventID"] is None
|
|
|
- assert response.data["nextEventID"] == "b" * 32
|
|
|
- assert response.data["projectSlug"] == self.project.slug
|
|
|
-
|
|
|
- def test_no_access(self):
|
|
|
- url = reverse(
|
|
|
- "sentry-api-0-organization-event-details-oldest",
|
|
|
- kwargs={"organization_slug": self.project.organization.slug},
|
|
|
- )
|
|
|
-
|
|
|
- response = self.client.get(url, format="json")
|
|
|
-
|
|
|
- assert response.status_code == 404, response.content
|
|
|
-
|
|
|
- def test_no_event(self):
|
|
|
- new_org = self.create_organization(owner=self.user)
|
|
|
- self.create_project(organization=new_org)
|
|
|
- url = reverse(
|
|
|
- "sentry-api-0-organization-event-details-oldest",
|
|
|
- kwargs={"organization_slug": new_org.slug},
|
|
|
- )
|
|
|
-
|
|
|
- with self.feature("organizations:events-v2"):
|
|
|
- response = self.client.get(url, format="json")
|
|
|
-
|
|
|
- assert response.status_code == 404, response.content
|
|
|
-
|
|
|
- def test_query_with_issue_id(self):
|
|
|
- url = reverse(
|
|
|
- "sentry-api-0-organization-event-details-oldest",
|
|
|
- kwargs={"organization_slug": self.project.organization.slug},
|
|
|
- )
|
|
|
- query = {"query": "issue.id:{}".format(self.groups[1].id)}
|
|
|
-
|
|
|
- with self.feature("organizations:events-v2"):
|
|
|
- response = self.client.get(url, query, format="json")
|
|
|
-
|
|
|
- assert response.status_code == 200, response.content
|
|
|
- assert response.data["id"] == "c" * 32
|
|
|
- assert response.data["previousEventID"] is None
|
|
|
- assert response.data["nextEventID"] is None
|
|
|
- assert response.data["projectSlug"] == self.project.slug
|