Skip to content

Commit

Permalink
Fix failures caused by base class MonthlyReporter update
Browse files Browse the repository at this point in the history
  • Loading branch information
cslzchen committed Dec 4, 2024
1 parent 663db9b commit d34cac0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions osf/metrics/reporters/private_spam_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
class PrivateSpamMetricsReporter(MonthlyReporter):
report_name = 'Private Spam Metrics'

def report(self, report_yearmonth):
target_month = report_yearmonth.target_month()
next_month = report_yearmonth.next_month()
def report(self):
target_month = self.yearmonth.target_month()
next_month = self.yearmonth.next_month()

oopspam_client = OOPSpamClient()
akismet_client = AkismetClient()

report = PrivateSpamMetricsReport(
report_yearmonth=str(report_yearmonth),
report_yearmonth=str(self.yearmonth),
node_oopspam_flagged=oopspam_client.get_flagged_count(target_month, next_month, category='node'),
node_oopspam_hammed=oopspam_client.get_hammed_count(target_month, next_month, category='node'),
node_akismet_flagged=akismet_client.get_flagged_count(target_month, next_month, category='node'),
Expand Down
4 changes: 2 additions & 2 deletions osf_tests/metrics/test_spam_count_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def test_private_spam_metrics_reporter():
mock_akismet_get_flagged_count.return_value = 20
mock_akismet_get_hammed_count.return_value = 10

reporter = PrivateSpamMetricsReporter()
report = reporter.report(report_yearmonth)[0]
reporter = PrivateSpamMetricsReporter(report_yearmonth)
report = reporter.report()[0]

assert report.node_oopspam_flagged == 10, f"Expected 10, got {report.node_oopspam_flagged}"
assert report.node_oopspam_hammed == 5, f"Expected 5, got {report.node_oopspam_hammed}"
Expand Down

0 comments on commit d34cac0

Please sign in to comment.