From 53d56f0464aad115f3dac0cb10fbf5960e748c55 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone <exarkun@twistedmatrix.com> Date: Tue, 20 Aug 2019 14:46:14 -0400 Subject: [PATCH] Improve this test marginally --- src/_zkapauthorizer/_storage_server.py | 18 +++++++++++++++--- .../tests/test_storage_protocol.py | 13 +++++++++---- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/_zkapauthorizer/_storage_server.py b/src/_zkapauthorizer/_storage_server.py index d9c7739..3f9aec7 100644 --- a/src/_zkapauthorizer/_storage_server.py +++ b/src/_zkapauthorizer/_storage_server.py @@ -117,7 +117,14 @@ class ZKAPAuthorizerStorageServer(Referenceable): """ return self._original.remote_advise_corrupt_share(*a, **kw) - def remote_slot_testv_and_readv_and_writev(self, tokens, *a, **kw): + def remote_slot_testv_and_readv_and_writev( + self, + tokens, + storage_index, + secrets, + tw_vectors, + r_vector, + ): """ Pass through after a token check to ensure clients can only allocate storage for mutable shares if they present valid tokens. @@ -132,8 +139,13 @@ class ZKAPAuthorizerStorageServer(Referenceable): # about (and don't expose over the network): renew_leases. We always # pass False for this because we want to manage leases completely # separately from writes. - kw["renew_leases"] = False - return self._original.slot_testv_and_readv_and_writev(*a, **kw) + return self._original.slot_testv_and_readv_and_writev( + storage_index, + secrets, + tw_vectors, + r_vector, + renew_leases=False, + ) def remote_slot_readv(self, *a, **kw): """ diff --git a/src/_zkapauthorizer/tests/test_storage_protocol.py b/src/_zkapauthorizer/tests/test_storage_protocol.py index 0eb82e0..51cac39 100644 --- a/src/_zkapauthorizer/tests/test_storage_protocol.py +++ b/src/_zkapauthorizer/tests/test_storage_protocol.py @@ -29,7 +29,8 @@ from testtools import ( from testtools.matchers import ( Equals, HasLength, - Always, + IsInstance, + AfterPreprocessing, ) from testtools.twistedsupport import ( succeeded, @@ -529,11 +530,15 @@ class ShareTests(TestCase): True, ) - # The operation should fail. I'm not that concerned with how just - # yet. + # The operation should fail. self.expectThat( d, - failed(Always()), + failed( + AfterPreprocessing( + lambda f: f.value, + IsInstance(TypeError), + ), + ), ) # There should be no shares at the given storage index. -- GitLab