-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
tests(alerts): Increase test coverage in incident chart test #100936
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
base: master
Are you sure you want to change the base?
Conversation
class FetchOpenPeriodsTest(TestCase): | ||
@freeze_time(frozen_time) | ||
@patch("sentry.incidents.charts.client.get") | ||
@with_feature("organizations:incidents") |
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.
Without this we were actually hitting a 404 hitting the incidents endpoint, but the test didn't care to check
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #100936 +/- ##
========================================
Coverage 81.11% 81.12%
========================================
Files 8659 8659
Lines 384312 384312
Branches 24251 24251
========================================
+ Hits 311746 311759 +13
+ Misses 72222 72209 -13
Partials 344 344 |
18aa429
to
fbc260e
Compare
fbc260e
to
f1f16e6
Compare
time_period = incident_date_range(60, incident.date_started, incident.date_closed) | ||
|
||
fetch_metric_issue_open_periods(self.organization, detector.id, time_period) | ||
mock_client_get.assert_called_with( |
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 recognize that I'm changing what's being tested here, but I'm not sure the previous test was adding much value. I can keep it around and add this as an additional test if necessary.
While working on https://getsentry.atlassian.net/browse/ACI-482 I was not able to find a test that asserted the output of
fetch_metric_issue_open_periods
. Since I'll be changing the response I wanted a test to be able to compare against and this one only checked that it was called with the expected params.This is a little futile since we'll be moving away from this but it's helpful as a starting point.