Esempio n. 1
0
 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)
Esempio n. 2
0
 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)
Esempio n. 3
0
 def test_allow_call_coach_false(self):
     CommandCall(user='******',
                 _value=CommandCall.COACH,
                 _datetime=pendulum.now()).save()
     self.assertFalse(CommandCall.allow_call(command=CommandCall.COACH))
Esempio n. 4
0
 def test_allow_call_coach_true(self):
     CommandCall(user='******',
                 _value=CommandCall.COACH,
                 _datetime=pendulum.yesterday()).save()
     self.assertTrue(CommandCall.allow_call(command=CommandCall.COACH))
Esempio n. 5
0
 def test_is_cooldown_over_false(self):
     c = CommandCall(user='******',
                     _value=CommandCall.COACH,
                     _datetime=pendulum.now()).save()
     self.assertFalse(c.is_cooldown_over())
Esempio n. 6
0
 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())
Esempio n. 7
0
 def test_is_cooldown_over_true(self):
     c = CommandCall(user='******',
                     _value=CommandCall.COACH,
                     _datetime=pendulum.yesterday()).save()
     self.assertTrue(c.is_cooldown_over())
Esempio n. 8
0
 def test_allow_call_shared_false_2(self):
     CommandCall(user='******',
                 _value=CommandCall.COACH,
                 _datetime=pendulum.now()).save()
     self.assertFalse(CommandCall.allow_call(shared=True))
Esempio n. 9
0
 def test_allow_call_shared_true_2(self):
     CommandCall(user='******',
                 _value=CommandCall.COACH,
                 _datetime=pendulum.yesterday()).save()
     self.assertTrue(CommandCall.allow_call(shared=True))
Esempio n. 10
0
 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))