From 81ca745bfa27c31e96cb8295fb8588301c7a9eb5 Mon Sep 17 00:00:00 2001 From: Kieran Prasch Date: Fri, 25 Jun 2021 13:43:41 -0700 Subject: [PATCH] Fixes incorrect splitter in map versioning and grant test assertion. --- nucypher/policy/maps.py | 4 ++-- tests/acceptance/characters/test_decentralized_grant.py | 9 +++++++-- .../characters/test_federated_grant_and_revoke.py | 1 - 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/nucypher/policy/maps.py b/nucypher/policy/maps.py index bbddf85d9..25e7d98b8 100644 --- a/nucypher/policy/maps.py +++ b/nucypher/policy/maps.py @@ -351,13 +351,13 @@ class SignedTreasureMap(TreasureMap): cls._splitters['unversioned'] = BytestringKwargifier(cls, blockchain_signature=EIP712_MESSAGE_SIGNATURE_SIZE, - public_signature=Signature, + public_signature=signature_splitter, hrac=(bytes, HRAC_LENGTH), message_kit=(UmbralMessageKit, VariableLengthBytestring), ) cls._splitters[1] = TreasureMapSplitter(cls, blockchain_signature=EIP712_MESSAGE_SIGNATURE_SIZE, - public_signature=Signature, + public_signature=signature_splitter, hrac=(bytes, HRAC_LENGTH), message_kit=(UmbralMessageKit, VariableLengthBytestring), ) diff --git a/tests/acceptance/characters/test_decentralized_grant.py b/tests/acceptance/characters/test_decentralized_grant.py index 60d616358..f5c00b3fb 100644 --- a/tests/acceptance/characters/test_decentralized_grant.py +++ b/tests/acceptance/characters/test_decentralized_grant.py @@ -15,12 +15,14 @@ You should have received a copy of the GNU Affero General Public License along with nucypher. If not, see . """ + import datetime + import maya import pytest +from nucypher.crypto.kits import PolicyMessageKit from nucypher.crypto.utils import keccak_digest -from nucypher.datastore.models import PolicyArrangement from nucypher.datastore.models import TreasureMap as DatastoreTreasureMap from nucypher.policy.maps import SignedTreasureMap @@ -50,7 +52,10 @@ def test_decentralized_grant(blockchain_alice, blockchain_bob, blockchain_ursula for ursula in blockchain_ursulas: if ursula.checksum_address in policy.treasure_map.destinations: kfrag_kit = policy.treasure_map.destinations[ursula.checksum_address] - assert bool(kfrag_kit) # TODO: try to decrypt? + + # TODO: try to decrypt? + # TODO: Use a new type for EncryptedKFrags? + assert isinstance(kfrag_kit, PolicyMessageKit) def test_alice_sets_treasure_map_decentralized(enacted_blockchain_policy, blockchain_alice, blockchain_bob, blockchain_ursulas): diff --git a/tests/integration/characters/test_federated_grant_and_revoke.py b/tests/integration/characters/test_federated_grant_and_revoke.py index 4fb0f8cfb..893eed794 100644 --- a/tests/integration/characters/test_federated_grant_and_revoke.py +++ b/tests/integration/characters/test_federated_grant_and_revoke.py @@ -54,7 +54,6 @@ def test_federated_grant(federated_alice, federated_bob, federated_ursulas): assert ursula.checksum_address in policy.treasure_map.destinations - def test_federated_alice_can_decrypt(federated_alice, federated_bob): """ Test that alice can decrypt data encrypted by an enrico