Пример #1
0
    def test_token_not_defined(self):
        e = Event()
        c = SecurityContext()
        h = AnonymousAuthenticationHandler('provider_name', c)

        h.handle(e)

        self.assertIsInstance(c.token, AnonymousToken)
Пример #2
0
    def test_token_already_set(self):
        c = SecurityContext()
        c.token = Token('key', 'user')

        e = Event()
        h = AnonymousAuthenticationHandler('provider_name', c)

        h.handle(e)

        self.assertNotIsInstance(c.token, AnonymousToken)