Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref: fix some various test mypy errors in mypy 1.11 #74853

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions tests/sentry/api/endpoints/test_organization_stats.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import functools
import sys

from django.urls import reverse
Expand Down Expand Up @@ -82,16 +81,14 @@ def test_id_filtering(self):
teams=[self.create_team(organization=org, members=[self.user])]
)

make_request = functools.partial(
self.client.get, reverse("sentry-api-0-organization-stats", args=[org.slug])
)
url = reverse("sentry-api-0-organization-stats", args=[org.slug])

response = make_request({"id": [project.id], "group": "project"})
response = self.client.get(url, {"id": str(project.id), "group": "project"})

assert response.status_code == 200, response.content
assert project.id in response.data

response = make_request({"id": [sys.maxsize], "group": "project"})
response = self.client.get(url, {"id": str(sys.maxsize), "group": "project"})

assert project.id not in response.data

Expand All @@ -106,12 +103,11 @@ def test_project_id_only(self):
teams=[self.create_team(organization=org, members=[self.user])]
)

make_request = functools.partial(
self.client.get, reverse("sentry-api-0-organization-stats", args=[org.slug])
response = self.client.get(
reverse("sentry-api-0-organization-stats", args=[org.slug]),
{"projectID": str(project.id), "group": "project"},
)

response = make_request({"projectID": [project.id], "group": "project"})

assert response.status_code == 200, response.content
assert project.id in response.data
assert project2.id not in response.data
22 changes: 11 additions & 11 deletions tests/snuba/api/endpoints/test_organization_stats_summary.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from __future__ import annotations

import functools
from datetime import datetime, timedelta, timezone
from typing import Any

from django.urls import reverse

Expand Down Expand Up @@ -736,17 +739,14 @@ def test_category_filter(self):
}

def test_download(self):
make_request = functools.partial(
self.client.get,
reverse("sentry-api-0-organization-stats-summary", args=[self.org.slug]),
)
response = make_request(
{
"statsPeriod": "2d",
"interval": "1d",
"field": ["sum(quantity)", "sum(times_seen)"],
"download": True,
}
req: dict[str, Any] = {
"statsPeriod": "2d",
"interval": "1d",
"field": ["sum(quantity)", "sum(times_seen)"],
"download": True,
}
response = self.client.get(
reverse("sentry-api-0-organization-stats-summary", args=[self.org.slug]), req
)

assert response.headers["Content-Type"] == "text/csv"
Expand Down
Loading