aboutsummaryrefslogtreecommitdiff
blob: 0807a3d9e93e0a751720a22cf40949d7107fbcbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# vim:fileencoding=utf8:et:ts=4:sts=4:sw=4:ft=python

from django.test import TestCase

from okupy.accounts.openid_store import DjangoDBOpenIDStore

import time


class OpenIDStoreTests(TestCase):
    def setUp(self):
        self.store = DjangoDBOpenIDStore()

    def test_nonce_integrity(self):
        nonce = ('http://example.com', time.time(), 'pepper')
        # first one should succeed, the second one should fail because
        # of reused nonce
        self.assertTrue(self.store.useNonce(*nonce))
        self.assertFalse(self.store.useNonce(*nonce))