Commits

Peter Sagerson  committed 6cac99f

Fix otp_yubikey tests on some databases.

The move away from test fixtures inadvertantly made the tests assume that the database would allocate specific primary keys.

  • Participants
  • Parent commits 8d1d416

Comments (0)

Files changed (1)

File django-otp-yubikey/otp_yubikey/tests.py

 
 
 class YubikeyTest(TestCase):
-    alice_public = 'cccccccb'
-    alice_aes = unhexlify('fb362a0853be5e5306d5cc2483f279cb')
-    alice_key = YubiKey(unhexlify('5dc30490956b'), 6, 0)
-
-    bob_public = 'cccccccd'
-    bob_key = YubiKey(unhexlify('326f70826d31'), 11, 0)
-    bob_aes = unhexlify('11080a0e7a56d0a1546f327f20626308')
+    # YubiKey device simulators.
+    alice_key = YubiKey(unhexlify(b'5dc30490956b'), 6, 0)
+    bob_key = YubiKey(unhexlify(b'326f70826d31'), 11, 0)
 
     def setUp(self):
         try:
             self.alice_device = alice.yubikeydevice_set.create(
                 private_id='5dc30490956b',
                 key='fb362a0853be5e5306d5cc2483f279cb', session=5, counter=0)
+            self.alice_public = self.alice_device.public_id()
+
             self.bob_device = bob.yubikeydevice_set.create(
                 private_id='326f70826d31',
                 key='11080a0e7a56d0a1546f327f20626308', session=10, counter=3)
+            self.bob_public = self.bob_device.public_id()
 
     def test_verify_alice(self):
         _, token = self.alice_token()
             otp.counter = counter
 
         return otp, encode_otp(otp, self.alice_aes, self.alice_public)
+
+    @property
+    def alice_aes(self):
+        return self.alice_device.bin_key
+
+    @property
+    def bob_aes(self):
+        return self.bob_device.bin_key