diff --git a/itests/tests/conftest.py b/itests/tests/conftest.py index a4b0e853..b137e6c4 100644 --- a/itests/tests/conftest.py +++ b/itests/tests/conftest.py @@ -77,19 +77,37 @@ def nonwhitelisted_signing_key(server_stub, admin_stub): yield signing_key @pytest.fixture -def saved_squeak_hash(server_stub, admin_stub): +def signing_profile_id(server_stub, admin_stub): # Create a new signing profile - profile_name = "alice" + profile_name = "fake_signing_profile" create_signing_profile_response = admin_stub.CreateSigningProfile( squeak_admin_pb2.CreateSigningProfileRequest(profile_name=profile_name,) ) profile_id = create_signing_profile_response.profile_id + yield profile_id +@pytest.fixture +def contact_profile_id(server_stub, admin_stub): + # Create a new contact profile + contact_name = "fake_contact_profile" + contact_signing_key = generate_signing_key() + contact_address = get_address(contact_signing_key) + create_contact_profile_response = admin_stub.CreateContactProfile( + squeak_admin_pb2.CreateContactProfileRequest( + profile_name=contact_name, + address=contact_address, + ) + ) + contact_profile_id = create_contact_profile_response.profile_id + yield contact_profile_id + +@pytest.fixture +def saved_squeak_hash(server_stub, admin_stub, signing_profile_id): # Create a new squeak using the new profile make_squeak_content = "Hello from the profile on the server!" make_squeak_response = admin_stub.MakeSqueak( squeak_admin_pb2.MakeSqueakRequest( - profile_id=profile_id, content=make_squeak_content, + profile_id=signing_profile_id, content=make_squeak_content, ) ) squeak_hash_str = make_squeak_response.squeak_hash diff --git a/itests/tests/test_squeak_node.py b/itests/tests/test_squeak_node.py index e7836d7a..ec5b11c6 100644 --- a/itests/tests/test_squeak_node.py +++ b/itests/tests/test_squeak_node.py @@ -430,24 +430,11 @@ def test_make_contact_profile(server_stub, admin_stub): ] assert contact_name in contact_profile_names -def test_set_profile_whitelisted(server_stub, admin_stub): - # Create a new contact profile - contact_name = "whitelisted_contact" - contact_signing_key = generate_signing_key() - contact_address = get_address(contact_signing_key) - create_contact_profile_response = admin_stub.CreateContactProfile( - squeak_admin_pb2.CreateContactProfileRequest( - profile_name=contact_name, - address=contact_address, - ) - ) - contact_profile_id = create_contact_profile_response.profile_id - - # Get the new squeak profile +def test_set_profile_whitelisted(server_stub, admin_stub, contact_profile_id): + # Get the existing profile get_squeak_profile_response = admin_stub.GetSqueakProfile( squeak_admin_pb2.GetSqueakProfileRequest(profile_id=contact_profile_id,) ) - assert get_squeak_profile_response.squeak_profile.profile_name == contact_name assert get_squeak_profile_response.squeak_profile.whitelisted == False # Set the profile to be whitelisted @@ -462,5 +449,4 @@ def test_set_profile_whitelisted(server_stub, admin_stub): get_squeak_profile_response = admin_stub.GetSqueakProfile( squeak_admin_pb2.GetSqueakProfileRequest(profile_id=contact_profile_id,) ) - assert get_squeak_profile_response.squeak_profile.profile_name == contact_name assert get_squeak_profile_response.squeak_profile.whitelisted == True