def test_resume(self):
self.start()
self.assertEquals(interface.do_fsm("stop")[0],"ok")
self.assertEquals(interface.do_fsm("start")[0],"ok")
prog = re.compile('started .* left.*')
self.assertTrue(prog.match(interface.do_fsm("status")[0]))
self.assertEquals(interface.do_fsm("pause")[0],"ok")
prog = re.compile('paused .* left.*')
self.assertTrue(prog.match(interface.do_fsm("status")[0]))
self.assertEquals(interface.do_fsm("start")[0],"ok")
self.assertEquals(interface.do_fsm("start")[0],"Already started")
# test done and resume
other_task = Task(self.tw, description="task 2 for the test")
other_task.save()
uuid2 = other_task['uuid']
self.assertEquals(interface.do_start(dbus.Dictionary({'uuid': uuid2 , 'resume': 'No'}))[0],"started:"+uuid2)
prog = re.compile('started .* left.*')
self.assertTrue(prog.match(interface.do_fsm("status")[0]))
self.assertEquals(interface.do_fsm("stop")[0],"ok")
other_task.done()
self.assertEquals(interface.do_fsm("start")[0],"ok")
self.assertTrue(prog.match(interface.do_fsm("status")[0]))
# test delete and resume
other_task = Task(self.tw, description="task 3 for the test")
other_task.save()
uuid2 = other_task['uuid']
self.assertEquals(interface.do_start(dbus.Dictionary({'uuid': uuid2 , 'resume': 'No'}))[0],"started:"+uuid2)
prog = re.compile('started .* left.*')
self.assertTrue(prog.match(interface.do_fsm("status")[0]))
self.assertEquals(interface.do_fsm("stop")[0],"ok")
other_task.delete()
self.assertEquals(interface.do_fsm("start")[0],"ok")
self.assertTrue(prog.match(interface.do_fsm("status")[0]))
评论列表
文章目录