summaryrefslogtreecommitdiff
path: root/apps/patchmetrics/tests/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'apps/patchmetrics/tests/models.py')
-rw-r--r--apps/patchmetrics/tests/models.py33
1 files changed, 0 insertions, 33 deletions
diff --git a/apps/patchmetrics/tests/models.py b/apps/patchmetrics/tests/models.py
index e289106..e0cca4b 100644
--- a/apps/patchmetrics/tests/models.py
+++ b/apps/patchmetrics/tests/models.py
@@ -10,7 +10,6 @@ from patchmetrics.models import (
GerritChange,
get_distinct_author_count,
get_overall_patch_count,
- get_patches_per_month_up_to,
get_patches_accepted_by_age_range,
get_patches_waiting_for_feedback_by_age_range,
get_submitted_patch_counts_for_month,
@@ -113,38 +112,6 @@ class TestChartHelpers(TestCase):
self.assertEqual(
(2, 1), get_submitted_patch_counts_for_month(now.year, now.month))
- def test_get_patches_per_month_up_to(self):
- patch1 = factory.makeLinaroPatch()
- patch2 = factory.makeLinaroPatch(state_name='Accepted')
- now = datetime.now()
- last_month = now - relativedelta.relativedelta(months=1)
- patch3 = factory.makeLinaroPatch(date=last_month)
- # Although we have a patch from 3 months ago we won't get a count for
- # that month because we'll ask get_overall_patches_per_month_up_to to
- # give us the counts for the last two months (this one and the
- # previous) only.
- three_months_ago = now - relativedelta.relativedelta(months=3)
- patch4 = factory.makeLinaroPatch(date=three_months_ago)
- # Monkey-patch PATCH_TRACKING_EPOCH to make the results predictable.
- orig_epoch = models.PATCH_TRACKING_EPOCH
- models.PATCH_TRACKING_EPOCH = datetime(
- year=last_month.year, month=three_months_ago.month, day=1)
- try:
- submitted, accepted = get_patches_per_month_up_to(
- now.year, now.month, get_overall_patch_count, limit=2)
- finally:
- models.PATCH_TRACKING_EPOCH = orig_epoch
-
- # get_overall_patches_per_month_up_to() returns timestamps in
- # miliseconds so we need to divide them by 1000 here.
- submitted = [(time.gmtime(timestamp / 1000).tm_mon, count)
- for timestamp, count in submitted]
- self.assertEqual([(last_month.month, 1), (now.month, 2)], submitted)
-
- accepted = [(time.gmtime(timestamp / 1000).tm_mon, count)
- for timestamp, count in accepted]
- self.assertEqual([(last_month.month, 0), (now.month, 1)], accepted)
-
def test_get_patches_accepted_by_age_range(self):
four_days_ago = datetime.now() - timedelta(days=4)
patch1 = factory.makeLinaroPatch(state_name='Accepted')