[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [bridgedb/develop] Fix test suite for bridgedb.scheduled.Unscheduled
commit a9e65a0c9c3e40359731b6fe3408e068f9c1501a
Author: Robert Ransom <rransom.8774@xxxxxxxxx>
Date: Tue Jul 15 04:04:46 2014 -0400
Fix test suite for bridgedb.scheduled.Unscheduled
Previously, the test suite checked only that Unscheduled.getInterval would
return a particular value when invoked with no argument. Now, the test
suite checks the only property of Unscheduled.getInterval that its callers
rely on: that it returns the same string regardless of which time is passed
in to it.
---
lib/bridgedb/test/test_schedule.py | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/lib/bridgedb/test/test_schedule.py b/lib/bridgedb/test/test_schedule.py
index 24c45ef..178e3e4 100644
--- a/lib/bridgedb/test/test_schedule.py
+++ b/lib/bridgedb/test/test_schedule.py
@@ -36,10 +36,21 @@ class UnscheduledTests(unittest.TestCase):
self.assertIsInstance(time, int)
self.assertEquals(time, -62135596800)
- def test_Unscheduled_getInterval_noargs(self):
- time = self.sched.getInterval()
- self.assertIsInstance(time, str)
- self.assertEquals(time, "1970-01-01 00:00:00")
+ def test_Unscheduled_getInterval_is_constant(self):
+ import time
+ now = time.time()
+
+ interval_default = self.sched.getInterval()
+ self.assertIsInstance(interval_default, str)
+
+ interval_zero = self.sched.getInterval(0)
+ self.assertIsInstance(interval_zero, str)
+
+ interval_now = self.sched.getInterval(now)
+ self.assertIsInstance(interval_now, str)
+
+ self.assertEquals(interval_default, interval_zero)
+ self.assertEquals(interval_default, interval_now)
def test_Unscheduled_nextIntervalStarts_noargs(self):
time = self.sched.nextIntervalStarts()
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits