示例#1
0
 def test_tell_store_messages_based_on_labels(self):
     chk_point = Checkpoint(Point.checkin)
     chk_point.start()
     chk_point.tell('Foo', Status.ok, label='zip')
     self.assertEqual(chk_point.messages[0].label, 'zip')
     self.assertEqual(chk_point.messages[0].message, 'Foo')
     self.assertEqual(chk_point.messages[0].status, Status.ok)
示例#2
0
 def test_tell_raises_RuntimeError_on_inactive_objects(self):
     chk_point = Checkpoint(Point.checkin)
     chk_point.start()
     chk_point.end()
     self.assertRaises(
         RuntimeError,
         lambda: chk_point.tell('Foo', Status.ok, label='zip'))
示例#3
0
 def test_tell_store_messages(self):
     chk_point = Checkpoint(Point.checkin)
     chk_point.start()
     chk_point.tell('Foo', Status.ok)
     self.assertEqual(chk_point.messages[0].label, None)
     self.assertEqual(chk_point.messages[0].message, 'Foo')
     self.assertEqual(chk_point.messages[0].status, Status.ok)
示例#4
0
 def test_tell_store_messages(self):
     chk_point = Checkpoint(Point.checkin)
     chk_point.start()
     chk_point.tell('Foo', Status.ok)
     self.assertEqual(chk_point.messages[0].label, None)
     self.assertEqual(chk_point.messages[0].message, 'Foo')
     self.assertEqual(chk_point.messages[0].status, Status.ok)
示例#5
0
 def test_tell_store_messages_based_on_labels(self):
     chk_point = Checkpoint(Point.checkin)
     chk_point.start()
     chk_point.tell('Foo', Status.ok, label='zip')
     self.assertEqual(chk_point.messages[0].label, 'zip')
     self.assertEqual(chk_point.messages[0].message, 'Foo')
     self.assertEqual(chk_point.messages[0].status, Status.ok)
示例#6
0
    def test_start_is_idempotent(self):
        chk_point = Checkpoint(Point.checkin)
        chk_point.start()
        date1 = chk_point.started_at
        chk_point.start()
        date2 = chk_point.started_at

        self.assertEqual(date1, date2)
示例#7
0
    def test_start_is_idempotent(self):
        chk_point = Checkpoint(Point.checkin)
        chk_point.start()
        date1 = chk_point.started_at
        chk_point.start()
        date2 = chk_point.started_at

        self.assertEqual(date1, date2)
示例#8
0
 def test_is_active_returns_False_after_end(self):
     chk_point = Checkpoint(Point.checkin)
     chk_point.start()
     chk_point.end()
     self.assertEqual(chk_point.is_active, False)
示例#9
0
 def test_is_active_returns_True_after_start(self):
     chk_point = Checkpoint(Point.checkin)
     chk_point.start()
     self.assertEqual(chk_point.is_active, True)
示例#10
0
    def test_ended_at_is_filled_on_end(self):
        chk_point = Checkpoint(Point.checkin)
        chk_point.start()
        chk_point.end()

        self.assertIsInstance(chk_point.ended_at, datetime)
示例#11
0
 def test_is_active_returns_False_after_end(self):
     chk_point = Checkpoint(Point.checkin)
     chk_point.start()
     chk_point.end()
     self.assertEqual(chk_point.is_active, False)
示例#12
0
 def test_is_active_returns_True_after_start(self):
     chk_point = Checkpoint(Point.checkin)
     chk_point.start()
     self.assertEqual(chk_point.is_active, True)
示例#13
0
    def test_ended_at_is_filled_on_end(self):
        chk_point = Checkpoint(Point.checkin)
        chk_point.start()
        chk_point.end()

        self.assertIsInstance(chk_point.ended_at, datetime)
示例#14
0
 def test_tell_raises_RuntimeError_on_inactive_objects(self):
     chk_point = Checkpoint(Point.checkin)
     chk_point.start()
     chk_point.end()
     self.assertRaises(RuntimeError, lambda: chk_point.tell('Foo', Status.ok, label='zip'))