Skip to content

Commit

Permalink
ref: fix some various test mypy errors in mypy 1.11 (#74853)
Browse files Browse the repository at this point in the history
<!-- Describe your PR here. -->
  • Loading branch information
asottile-sentry authored and Christinarlong committed Jul 26, 2024
1 parent 02fabbd commit 3cd1a3a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 21 deletions.
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

0 comments on commit 3cd1a3a

Please sign in to comment.