basic.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:pomodoroTasks2 作者: liloman 项目源码 文件源码
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]))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号