Exemple #1
0
 def test_create_checkpoint_nonce_creates_checkpoint_nonce(self):
     before = time.time()
     create_checkpoint_nonce()
     checkpoint = Nonce.objects.get(token_key="", consumer_key="")
     after = time.time()
     checkpoint_time = checkpoint.key[len(key_prefix):]
     self.assertLessEqual(before, float(checkpoint_time))
     self.assertGreaterEqual(after, float(checkpoint_time))
 def test_create_checkpoint_nonce_creates_checkpoint_nonce(self):
     before = time.time()
     create_checkpoint_nonce()
     checkpoint = Nonce.objects.get(token_key='', consumer_key='')
     after = time.time()
     checkpoint_time = checkpoint.key[len(key_prefix):]
     self.assertLessEqual(before, float(checkpoint_time))
     self.assertGreaterEqual(after, float(checkpoint_time))
Exemple #3
0
 def test_create_checkpoint_nonce_gets_checkpoint_if_exists(self):
     now = time.time()
     self.patch(module_time, "time").return_value = now
     create_checkpoint_nonce()
     nonce1 = Nonce.objects.filter(token_key="",
                                   consumer_key="").latest("id")
     create_checkpoint_nonce()
     nonce2 = Nonce.objects.filter(token_key="",
                                   consumer_key="").latest("id")
     self.assertEqual(nonce1.id, nonce2.id)
 def test_create_checkpoint_nonce_gets_checkpoint_if_exists(self):
     now = time.time()
     self.patch(module_time, "time").return_value = now
     create_checkpoint_nonce()
     nonce1 = Nonce.objects.filter(
         token_key='', consumer_key='').latest('id')
     create_checkpoint_nonce()
     nonce2 = Nonce.objects.filter(
         token_key='', consumer_key='').latest('id')
     self.assertEqual(nonce1.id, nonce2.id)