-
-
Notifications
You must be signed in to change notification settings - Fork 4k
/
test_organization_sessions.py
38 lines (27 loc) · 1.12 KB
/
test_organization_sessions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import pytest
from django.test.client import RequestFactory
from django.urls import reverse
from fixtures.apidocs_test_case import APIDocsTestCase
from sentry.testutils.cases import SnubaTestCase
pytestmark = pytest.mark.sentry_metrics
class OrganizationSessionsDocsTest(APIDocsTestCase, SnubaTestCase):
def setUp(self):
super().setUp()
self.organization = self.create_organization(owner=self.user, name="foo")
self.project = self.create_project(name="bar", organization=self.organization, teams=[])
self.url = reverse(
"sentry-api-0-organization-sessions",
kwargs={"organization_slug": self.organization.slug},
)
self.login_as(user=self.user)
def test_get(self):
query = {
"project": [self.project.id],
"statsPeriod": "30d",
"field": ["sum(session)"],
"groupBy": ["release"],
}
request = RequestFactory().get(self.url)
response = self.client.get(self.url, query)
assert response.status_code == 200, response.content
self.validate_schema(request, response)