def test_timer_not_running_when_stopped(self):
     user_timer = UserTimer(self.user, db)
     assert(user_timer.timer_get() is None)
     timer = user_timer.timer_create()
     timer.start()
     timer.stop()
     assert(not timer.is_running())
Exemplo n.º 2
0
 def _get_timer(self, id):
     query_set = User.objects(id=id)
     try:
         u = query_set.first()
         user_timer = UserTimer(u, db)
         return user_timer.timer_get()
     except:
         return None
 def test_can_restart_timer(self):
     user_timer = UserTimer(self.user, db)
     assert(user_timer.timer_get() is None)
     timer = user_timer.timer_create()
     timer.start()
     timer.stop()
     assert(not timer.is_running())
     timer.start()
     assert(timer.is_running())
     timer.stop()
     assert(not timer.is_running())
    def test_can_create_and_clear_timer_on_user_timer(self):
        assert(self.user.timer is None)
        user_timer = UserTimer(self.user, db)
        timer = user_timer.timer_create()
        assert(self.user.timer is not None)
        assert(timer is not None)
        assert(timer.userId is not None)

        user_timer.timer_clear()
        timer = user_timer.timer_get()
        assert(timer is None)
        assert(user_timer.user.timer is None)
 def test_can_create_user_timer(self):
     user_timer = UserTimer(self.user, db)
     assert(user_timer.timer_get() is None)