Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(44)  |  Call(44)  |  Derive(0)  |  Import(0)

src/d/j/django-otp-0.2.7/django_otp/plugins/otp_static/tests.py   django-otp(Download)
    def test_empty(self):
        data = {}
        form = OTPAuthenticationForm(None, data)
 
        self.assertTrue(not form.is_valid())
        form = OTPAuthenticationForm(None, data)
 
        self.assertTrue(not form.is_valid())
        self.assertTrue(form.get_user() is None)
        self.assertEqual(list(form.errors.keys()), ['__all__'])
        form = OTPAuthenticationForm(None, data)
 
        self.assertTrue(not form.is_valid())
        self.assertTrue(form.get_user().get_username() == 'alice')
 

src/d/j/django-otp-0.2.7/django_otp/plugins/otp_email/tests.py   django-otp(Download)
        form = OTPAuthenticationForm(None, data)
 
        self.assertTrue(not form.is_valid())
        alice = form.get_user()
        self.assertTrue(alice.get_username() == 'alice')
        self.assertTrue(alice.otp_device is None)
        form = OTPAuthenticationForm(None, data)
 
        self.assertTrue(form.is_valid())
        self.assertTrue(isinstance(form.get_user().otp_device, EmailDevice))
 

src/d/j/django-otp-0.2.7/django_otp/plugins/otp_hotp/tests.py   django-otp(Download)
    def test_normal(self):
        ok = self.device.verify_token(self.tokens[0])
 
        self.assertTrue(ok)
        self.assertEqual(self.device.counter, 1)
 
    def test_normal_drift(self):
        ok = self.device.verify_token(self.tokens[1])
 
        self.assertTrue(ok)
    def test_excessive_drift(self):
        ok = self.device.verify_token(self.tokens[2])
 
        self.assertTrue(not ok)
        self.assertEqual(self.device.counter, 0)
 
    def test_bad_value(self):
        ok = self.device.verify_token(123456)
 
        self.assertTrue(not ok)

src/d/j/django-otp-0.2.7/django_otp/plugins/otp_totp/tests.py   django-otp(Download)
            ok = self.device.verify_token(self.tokens[5])
 
        self.assertTrue(ok)
        self.assertEqual(self.device.drift, 2)
 
 
        self.assertEqual(self.device.last_t, 3)
        self.assertTrue(verified1)
        self.assertFalse(verified2)
 

src/d/j/django-otp-yubikey-0.2.0/otp_yubikey/tests.py   django-otp-yubikey(Download)
    def test_verify_alice(self):
        _, token = self.alice_token()
        ok = self.alice_device.verify_token(token)
 
        self.assertTrue(ok)
    def test_counter_increment(self):
        otp, token = self.alice_token(5, 7)
        ok = self.alice_device.verify_token(token)
 
        self.assertTrue(ok)
    def test_no_verify_mismatch(self):
        _, token = self.alice_token()
        ok = self.bob_device.verify_token(token)
 
        self.assertTrue(not ok)
        ok2 = self.alice_device.verify_token(token)
 
        self.assertTrue(ok1)
        self.assertTrue(not ok2)
        self.assertEqual(self.alice_device.session, otp.session)

src/d/j/django-otp-twilio-0.2.0/otp_twilio/tests.py   django-otp-twilio(Download)
        ok = device.verify_token(token)
 
        self.assertTrue(ok)
 
    def test_previous(self):
        device = self.alice.twiliosmsdevice_set.get()
        token = totp(device.bin_key, t0=30)
        ok = device.verify_token(token)
 
        self.assertTrue(ok)
        ok = device.verify_token(token)
 
        self.assertTrue(not ok)
 
    def test_future(self):
        device = self.alice.twiliosmsdevice_set.get()
        token = totp(device.bin_key, t0=-30)
        ok = device.verify_token(token)
 
        self.assertTrue(not ok)
        ok = self.bob.twiliosmsdevice_set.get().verify_token(token)
 
        self.assertTrue(not ok)