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

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

src/d/j/django-otp-0.2.7/django_otp/plugins/otp_totp/tests.py   django-otp(Download)
    def test_single(self):
        results = [self.device.verify_token(token) for token in self.tokens]
 
        self.assertEqual(results, [False] * 3 + [True] + [False] * 6)
 
    def test_tolerance(self):
        self.device.tolerance = 1
        results = [self.device.verify_token(token) for token in self.tokens]
 
        self.assertEqual(results, [False] * 2 + [True] * 3 + [False] * 5)
        results = [self.device.verify_token(token) for token in self.tokens]
 
        self.assertEqual(results, [False] * 1 + [True] * 3 + [False] * 6)
 
    def test_sync_drift(self):
 
        self.assertTrue(ok)
        self.assertEqual(self.device.drift, 2)
 
    def test_no_reuse(self):
        verified1 = self.device.verify_token(self.tokens[3])
        verified2 = self.device.verify_token(self.tokens[3])
 
        self.assertEqual(self.device.last_t, 3)

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)
        self.assertEqual(self.device.counter, 2)
    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)
        self.assertEqual(self.device.counter, 0)

src/d/j/django-otp-agents-0.2.0/otp_agents/tests.py   django-otp-agents(Download)
    def test_otp_anonymous(self):
        response = self.client.get('/otp/')
 
        self.assertEqual(response.status_code, 302)
 
    def test_otp_authenticated(self):
        self.login()
        response = self.client.get('/otp/')
 
        self.assertEqual(response.status_code, 302)
    def test_otp_verified(self):
        self.verify()
        response = self.client.get('/otp/')
 
        self.assertEqual(response.status_code, 200)
        response = self.client.get('/otp/')
 
        self.assertEqual(response.status_code, 302)
 
    def test_otp2_verified(self):
        self.verify()
        response = self.client.get('/otp2/')
 
        self.assertEqual(response.status_code, 200)

src/d/j/django-otp-0.2.7/django_otp/plugins/otp_static/tests.py   django-otp(Download)
 
        self.assertTrue(not form.is_valid())
        self.assertEqual(form.get_user(), None)
 
    def test_bad_password(self):
        self.assertTrue(not form.is_valid())
        self.assertTrue(form.get_user() is None)
        self.assertEqual(list(form.errors.keys()), ['__all__'])
 
    def test_no_token(self):
        self.assertTrue(alice.get_username() == 'alice')
        self.assertTrue(isinstance(alice.otp_device, StaticDevice))
        self.assertEqual(alice.otp_device.token_set.count(), 2)
 
    def test_spoofed_device(self):

src/d/j/django-otp-yubikey-0.2.0/otp_yubikey/tests.py   django-otp-yubikey(Download)
 
        self.assertTrue(ok)
        self.assertEqual(self.alice_device.session, 5)
        self.assertEqual(self.alice_device.counter, 7)
 
        self.assertTrue(ok1)
        self.assertTrue(not ok2)
        self.assertEqual(self.alice_device.session, otp.session)
        self.assertEqual(self.alice_device.counter, otp.counter)
 

src/d/j/django-otp-0.2.7/django_otp/plugins/otp_email/tests.py   django-otp(Download)
        self.assertTrue(alice.get_username() == 'alice')
        self.assertTrue(alice.otp_device is None)
        self.assertEqual(len(mail.outbox), 1)
 
        data['otp_token'] = mail.outbox[0].body