summaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
Diffstat (limited to 'test.py')
-rw-r--r--test.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/test.py b/test.py
index 5fbdd25..5ca77ea 100644
--- a/test.py
+++ b/test.py
@@ -8,6 +8,7 @@ import unittest
import signal_event_notifier as sen
DUMMY_CYCLIC_RESPONSIBILITIES = "alice:+1234\nbob:+5678,charlie:+5679"
+DUMMY_CYCLIC_RESPONSIBILITIES_3 = "alice:+1234\nbob:+5678\ncharlie:+5679"
TEST_CAL = "test/cal.ics"
@@ -33,11 +34,38 @@ class TestCyclicRespLoading(unittest.TestCase):
expected = [['alice:+1234'], ['bob:+5678', 'charlie:+5679']]
day = datetime.date(year=2013, month=1, day=1)
delta = datetime.timedelta(days=7)
- for week in range(52):
+ for week in range(52 * 2):
resp = sen.load_responsibilities(day)
self.assertEqual(resp, expected[(week % 2)])
day += delta
+# pragma pylint: disable=missing-function-docstring,missing-class-docstring,invalid-name
+class TestCyclicUnevenRespLoading(unittest.TestCase):
+
+ def setUp(self):
+ os.environ[
+ sen.
+ RESPONSIBILITIES_ENV_VAR_NAME] = DUMMY_CYCLIC_RESPONSIBILITIES_3
+
+ def test_cyclic_resp_all_weeks(self):
+ expected = [['alice:+1234'], ['bob:+5678'], ['charlie:+5679']]
+ day = datetime.date(year=2013, month=1, day=1)
+ delta = datetime.timedelta(days=7)
+ for week in range(52):
+ resp = sen.load_responsibilities(day)
+ self.assertEqual(resp, expected[(week % 3)])
+ day += delta
+
+ # Second year
+ expected = [['bob:+5678'], ['charlie:+5679'], ['alice:+1234']]
+ offset = 1
+
+ for week in range(52):
+ resp = sen.load_responsibilities(day, offset=offset)
+ self.assertEqual(resp, expected[(week % 3)])
+ day += delta
+
+
if __name__ == '__main__':
unittest.main()