def test_retrieveNonexistentSession(self): """ L{PersistentSessionWrapper.authenticatedUserForKey} returns C{None} if a session does not exist. """ store = Store() resource = PersistentSessionWrapper(store, None) user = resource.authenticatedUserForKey(b'doesnotexist') self.assertIdentical(user, None)
def test_retrieveSession(self): """ L{PersistentSessionWrapper.authenticatedUserForKey} returns the user to whom a session belongs. """ store = Store() resource = PersistentSessionWrapper(store, None) resource.createSessionForKey(b'key', b'username@domain') user = resource.authenticatedUserForKey(b'key') self.assertEqual(user, b'username@domain')