def test_removeNonexistentSession(self): """ L{PersistentSessionWrapper.removeSessionWithKey} does nothing if the session does not exist. """ store = Store() resource = PersistentSessionWrapper(store, None) resource.removeSessionWithKey(b'key')
def test_removeSession(self): """ L{PersistentSessionWrapper.removeSessionWithKey} removes an existing session with the given key. """ store = Store() resource = PersistentSessionWrapper(store, None) resource.createSessionForKey(b'key', b'username@domain') self.assertEqual(store.query(PersistentSession).count(), 1) resource.removeSessionWithKey(b'key') self.assertEqual(store.query(PersistentSession).count(), 0)