def test_clima_ordering(self): CommandCall(user='******', _value=CommandCall.CLIMA, _datetime=pendulum.yesterday()).save() c2 = CommandCall(user='******', _value=CommandCall.CLIMA, _datetime=pendulum.now()).save() self.assertAlmostEqual(CommandCall.objects.count(), 2) self.assertEqual(CommandCall.last_clima(), c2)
def test_ordering(self): c1 = CommandCall(user='******', _value=CommandCall.COACH, _datetime=pendulum.yesterday()).save() CommandCall(user='******', _value=CommandCall.COACH, _datetime=pendulum.now()).save() self.assertAlmostEqual(CommandCall.objects.count(), 2) self.assertEqual(CommandCall.objects.first(), c1)
def test_allow_call_coach_false(self): CommandCall(user='******', _value=CommandCall.COACH, _datetime=pendulum.now()).save() self.assertFalse(CommandCall.allow_call(command=CommandCall.COACH))
def test_allow_call_coach_true(self): CommandCall(user='******', _value=CommandCall.COACH, _datetime=pendulum.yesterday()).save() self.assertTrue(CommandCall.allow_call(command=CommandCall.COACH))
def test_is_cooldown_over_false(self): c = CommandCall(user='******', _value=CommandCall.COACH, _datetime=pendulum.now()).save() self.assertFalse(c.is_cooldown_over())
def test_is_cooldown_over_true_2(self): c = CommandCall(user='******', _value=CommandCall.COACH, _datetime=pendulum.now().subtract( seconds=CommandCall.COOLDOWN)).save() self.assertTrue(c.is_cooldown_over())
def test_is_cooldown_over_true(self): c = CommandCall(user='******', _value=CommandCall.COACH, _datetime=pendulum.yesterday()).save() self.assertTrue(c.is_cooldown_over())
def test_allow_call_shared_false_2(self): CommandCall(user='******', _value=CommandCall.COACH, _datetime=pendulum.now()).save() self.assertFalse(CommandCall.allow_call(shared=True))
def test_allow_call_shared_true_2(self): CommandCall(user='******', _value=CommandCall.COACH, _datetime=pendulum.yesterday()).save() self.assertTrue(CommandCall.allow_call(shared=True))
def test_allow_call_coach_clima_true(self): CommandCall(user='******', _value=CommandCall.COACH, _datetime=pendulum.now()).save() self.assertTrue(CommandCall.allow_call(command=CommandCall.CLIMA))