diff --git a/src/_zkapauthorizer/tests/test_storage_protocol.py b/src/_zkapauthorizer/tests/test_storage_protocol.py index 73f9017efa02cc256b05dc224ee6ef461b5488b7..0bd6cb80835986f16bee3f4eacfa72f635608bec 100644 --- a/src/_zkapauthorizer/tests/test_storage_protocol.py +++ b/src/_zkapauthorizer/tests/test_storage_protocol.py @@ -161,6 +161,13 @@ class ShareTests(TestCase): self.anonymous_storage_server = self.useFixture(AnonymousStorageServer()).storage_server def get_passes(message, count): + if not isinstance(message, bytes): + raise TypeError("message must be bytes") + try: + message.decode("utf-8") + except UnicodeDecodeError: + raise TypeError("message must be valid utf-8") + return [Pass(u"x" * TOKEN_LENGTH)] * count self.server = ZKAPAuthorizerStorageServer(