コード例 #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)
コード例 #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)
コード例 #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))
コード例 #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))
コード例 #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())
コード例 #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())
コード例 #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())
コード例 #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))
コード例 #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))
コード例 #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))