예제 #1
0
 def test_after_different_user_other_day(self):
     m1 = Message(datetime(2017, 9, 4, 12, 1), '*****@*****.**',
                  'Sing la la la')
     m2 = Message(datetime(2017, 9, 6, 9, 12),
                  '*****@*****.**', 'Play more')
     self.assertEqual(m2.after(m1),
                      ('2017-09-06', '09:12', 'johnny.b.goode'))
예제 #2
0
 def test_properties(self):
     d = datetime(2017, 9, 5, 14, 32, 16, 14230)
     m = Message(d, '*****@*****.**', 'some payload')
     self.assertEqual(m.day, '2017-09-05')
     self.assertEqual(m.hour, '14:32')
     self.assertEqual(m.shortname, 'johnny.b.goode')
예제 #3
0
 def test_after_none(self):
     m2 = Message(datetime(2017, 9, 4, 12, 1),
                  '*****@*****.**', 'Play more')
     self.assertEqual(m2.after(None),
                      ('2017-09-04', '12:01', 'johnny.b.goode'))
예제 #4
0
 def test_after_different_user_same_hour(self):
     m1 = Message(datetime(2017, 9, 4, 12, 1), '*****@*****.**',
                  'Sing la la la')
     m2 = Message(datetime(2017, 9, 4, 12, 1),
                  '*****@*****.**', 'Play more')
     self.assertEqual(m2.after(m1), (None, '12:01', 'johnny.b.goode'))
예제 #5
0
 def test_after_same_user_same_hour(self):
     m1 = Message(datetime(2017, 9, 4, 12, 1), '*****@*****.**',
                  'Sing la la la')
     m2 = Message(datetime(2017, 9, 4, 12, 1), '*****@*****.**',
                  'Play more')
     self.assertEqual(m2.after(m1), (None, None, None))
예제 #6
0
 def test_after_same_user_other_day(self):
     m1 = Message(datetime(2017, 9, 4, 12, 1), '*****@*****.**',
                  'Sing la la la')
     m2 = Message(datetime(2017, 9, 6, 9, 12), '*****@*****.**',
                  'Play more')
     self.assertEqual(m2.after(m1), ('2017-09-06', '09:12', 'chuck.berry'))