Exemple #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)
Exemple #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)
Exemple #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))
Exemple #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))
Exemple #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())
Exemple #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())
Exemple #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())
Exemple #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))
Exemple #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))
Exemple #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))