aboutsummaryrefslogtreecommitdiffstats
path: root/src/booking/tests/test_stats.py
diff options
context:
space:
mode:
authorJustin Choquette <jchoquette@iol.unh.edu>2023-06-08 12:46:53 -0400
committerJustin Choquette <jchoquette@iol.unh.edu>2023-07-21 13:17:51 -0400
commita09db9f287a02873c0226759f8ea444bb304cd59 (patch)
tree59e744e4b998973a808abbae2d21fbdd6201d829 /src/booking/tests/test_stats.py
parent8ddc7e820e120f1dde4e901d3cb6f1dd3f281e65 (diff)
LaaS 3.0 Almost MVP
Change-Id: Ided9a43cf3088bb58a233dc459711c03f43e11b8 Signed-off-by: Justin Choquette <jchoquette@iol.unh.edu>
Diffstat (limited to 'src/booking/tests/test_stats.py')
-rw-r--r--src/booking/tests/test_stats.py59
1 files changed, 0 insertions, 59 deletions
diff --git a/src/booking/tests/test_stats.py b/src/booking/tests/test_stats.py
deleted file mode 100644
index 5501355..0000000
--- a/src/booking/tests/test_stats.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#############################################################################
-# Copyright (c) 2018 Parker Berberian, Sawyer Bergeron, Sean Smith, and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-import pytz
-from datetime import timedelta, datetime
-
-from django.test import TestCase
-
-from booking.models import Booking
-from booking.stats import StatisticsManager as sm
-from dashboard.testing_utils import make_user
-
-
-class StatsTestCases(TestCase):
-
- def test_no_booking_outside_span(self):
- now = datetime.now(pytz.utc)
-
- bad_date = now + timedelta(days=1200)
- Booking.objects.create(start=now, end=bad_date, owner=make_user(username='jj'))
-
- actual = sm.getContinuousBookingTimeSeries()
- dates = actual['booking'][0]
-
- for date in dates:
- self.assertNotEqual(date, bad_date)
-
- def check_booking_and_user_counts(self):
- now = datetime.now(pytz.utc)
-
- for i in range(20):
- Booking.objects.create(
- start=now,
- end=now + timedelta(weeks=3),
- owner=make_user(username='a'))
-
- for i in range(30):
- Booking.objects.create(
- start=now + timedelta(days=5),
- end=now + timedelta(weeks=3, days=5),
- owner=make_user(username='a'))
-
- for i in range(120):
- Booking.objects.create(
- start=now + timedelta(weeks=1),
- end=now + timedelta(weeks=4),
- owner=make_user(username='a'))
-
- dates = [[now, 20], [now + timedelta(days=5), 30], [now + timedelta(weeks=1), 120]]
- actual = sm.getContinuousBookingTimeSeries()
-
- for date in dates:
- self.assertEqual(date[1], actual['booking'][date[0]])
- self.assertEqual(date[1], actual['booking'][date[1]])