Example #1
0
 def test_complete(self):
     t = Task(name='task')
     t.complete()
     self.assertEqual(t.status, 'complete')
     self.assertTrue(t.is_complete())
     self.assertTrue(t.is_done())
     self.assertFalse(t.is_failed())
Example #2
0
 def test_equality2(self):
     """State should not change equality"""
     t1 = Task(name='taskA')
     t2 = Task(name='taskA')
     t1.complete()
     self.assertEqual(t1, t2)
     self.assertEqual(t1.name, t2.name)
     self.assertEqual(t1.identity, t2.identity)
Example #3
0
 def test_to_dict(self):
     cmd = 'echo hello world'
     t = Task(name='task', cmd=cmd, foo='bar')
     t.complete()
     d = t.to_dict()
     self.assertEqual(d['name'], 'task')
     self.assertEqual(d['cmd'], cmd)
     self.assertEqual(d['foo'], 'bar')
     self.assertEqual(d['state']['status'], 'complete')