-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
feat(releases): Implement threshold details GET #55969
Conversation
Codecov Report
@@ Coverage Diff @@
## master #55969 +/- ##
==========================================
- Coverage 78.67% 78.67% -0.01%
==========================================
Files 5068 5070 +2
Lines 217677 217936 +259
Branches 36841 36881 +40
==========================================
+ Hits 171254 171453 +199
- Misses 40900 40958 +58
- Partials 5523 5525 +2
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 pending Cathy's comment
"GET": ApiPublishStatus.PRIVATE, | ||
} | ||
|
||
def get(self, request: Request, project: Project, threshold_id: str) -> HttpResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am assuming you will have a PUT (and maybe a DELETE), so it might be worth refactoring with a convert_args
function so you already have the ReleaseThreshold
object you're getting/modifying/deleting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
convert_args just allows us to convert the path param (threshold_id) into the actual model instance, correct?
) | ||
return Response(serialize(release_threshold, request.user), status=200) | ||
except ReleaseThreshold.DoesNotExist: | ||
return Response(status=404) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you want to raise ResourceDoesNotExist
?
from sentry.testutils.cases import APITestCase | ||
|
||
|
||
class ReleaseThresholdDetailsTest(APITestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: switch to using get_success_response
and get_error_response
over client.get
.
class ReleaseThresholdDetailsTest(APITestCase): | |
class ReleaseThresholdDetailsTest(APITestCase): | |
endpoint = "sentry-api-0-project-release-thresholds-details" | |
method = "get" |
url = reverse( | ||
"sentry-api-0-project-release-thresholds-details", | ||
kwargs={ | ||
"organization_slug": self.organization.slug, | ||
"project_slug": self.project.slug, | ||
"threshold_id": 123, | ||
}, | ||
) | ||
response = self.client.get(url) | ||
|
||
assert response.status_code == 404 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same nit, can switch to much shorter test request
url = reverse( | |
"sentry-api-0-project-release-thresholds-details", | |
kwargs={ | |
"organization_slug": self.organization.slug, | |
"project_slug": self.project.slug, | |
"threshold_id": 123, | |
}, | |
) | |
response = self.client.get(url) | |
assert response.status_code == 404 | |
self.get_error_response(self.organization.slug, self.project.slug, 123, status_code=404) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm... eh 🤷
I'm indifferent.
Sure it can make the tests shorter, but it makes them more difficult to decipher and obfuscates away what the test is actually testing for
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment comment comment
overall +1 pending nits from others
"GET": ApiPublishStatus.PRIVATE, | ||
} | ||
|
||
def get(self, request: Request, project: Project, threshold_id: str) -> HttpResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
convert_args just allows us to convert the path param (threshold_id) into the actual model instance, correct?
url = reverse( | ||
"sentry-api-0-project-release-thresholds-details", | ||
kwargs={ | ||
"organization_slug": self.organization.slug, | ||
"project_slug": self.project.slug, | ||
"threshold_id": 123, | ||
}, | ||
) | ||
response = self.client.get(url) | ||
|
||
assert response.status_code == 404 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm... eh 🤷
I'm indifferent.
Sure it can make the tests shorter, but it makes them more difficult to decipher and obfuscates away what the test is actually testing for
6a05002
to
def5205
Compare
13336c4
to
7e7ebe8
Compare
af46777
to
f373eb6
Compare
8c1399b
to
f67269e
Compare
Basic
GET
endpoint for release thresholds -> pass in an org id, project id, and threshold id, get back the details of the matching threshold.