diff options
author | Richard van der Hoff <richard@matrix.org> | 2019-07-19 17:49:19 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2019-07-19 17:49:19 +0100 |
commit | c7095be9136825efc5bd85181b0395b833f96aee (patch) | |
tree | 9764b8dbfefa84a750a9d305fa78afa65d70259e /tests | |
parent | Speed up the PostgreSQL unit tests (#5717) (diff) | |
download | synapse-c7095be9136825efc5bd85181b0395b833f96aee.tar.xz |
Refactor Keyring._start_key_lookups
There's an awful lot of deferreds and dictionaries flying around here. The whole thing can be made much simpler and achieve the same effect.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/crypto/test_keyring.py | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/tests/crypto/test_keyring.py b/tests/crypto/test_keyring.py index 795703967d..8d94a503d6 100644 --- a/tests/crypto/test_keyring.py +++ b/tests/crypto/test_keyring.py @@ -86,35 +86,6 @@ class KeyringTestCase(unittest.HomeserverTestCase): getattr(LoggingContext.current_context(), "request", None), expected ) - def test_wait_for_previous_lookups(self): - kr = keyring.Keyring(self.hs) - - lookup_1_deferred = defer.Deferred() - lookup_2_deferred = defer.Deferred() - - # we run the lookup in a logcontext so that the patched inlineCallbacks can check - # it is doing the right thing with logcontexts. - wait_1_deferred = run_in_context( - kr.wait_for_previous_lookups, {"server1": lookup_1_deferred} - ) - - # there were no previous lookups, so the deferred should be ready - self.successResultOf(wait_1_deferred) - - # set off another wait. It should block because the first lookup - # hasn't yet completed. - wait_2_deferred = run_in_context( - kr.wait_for_previous_lookups, {"server1": lookup_2_deferred} - ) - - self.assertFalse(wait_2_deferred.called) - - # let the first lookup complete (in the sentinel context) - lookup_1_deferred.callback(None) - - # now the second wait should complete. - self.successResultOf(wait_2_deferred) - def test_verify_json_objects_for_server_awaits_previous_requests(self): key1 = signedjson.key.generate_signing_key(1) |