diff --git a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_bbs.py b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_bbs.py index 85ccb8376..c5c5b60aa 100644 --- a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_bbs.py +++ b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_bbs.py @@ -12,7 +12,7 @@ from fastapi import HTTPException from app.models.issuer import SendCredential -from app.routes.connections import router as con_router +from app.routes.connections import router as conn_router from app.routes.issuer import router as issuer_router from app.routes.oob import router as oob_router from app.tests.util.connections import FaberAliceConnect @@ -21,7 +21,7 @@ CREDENTIALS_BASE_PATH = issuer_router.prefix OOB_BASE_PATH = oob_router.prefix -CONNECTIONS_BASE_PATH = con_router.prefix +CONNECTIONS_BASE_PATH = conn_router.prefix credential_ = SendCredential( diff --git a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_ed25519.py b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_ed25519.py index ee6a7290a..a709c1f6a 100644 --- a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_ed25519.py +++ b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_ed25519.py @@ -7,7 +7,7 @@ from fastapi import HTTPException from app.models.issuer import SendCredential -from app.routes.connections import router as con_router +from app.routes.connections import router as conn_router from app.routes.issuer import router as issuer_router from app.routes.oob import router as oob_router from app.tests.util.connections import FaberAliceConnect @@ -16,7 +16,7 @@ CREDENTIALS_BASE_PATH = issuer_router.prefix OOB_BASE_PATH = oob_router.prefix -CONNECTIONS_BASE_PATH = con_router.prefix +CONNECTIONS_BASE_PATH = conn_router.prefix credential_ = SendCredential( type="ld_proof", diff --git a/app/tests/e2e/issuer/test_connections_use_public_did.py b/app/tests/e2e/issuer/test_connections_use_public_did.py index 09ab5ae57..c05a3e37a 100644 --- a/app/tests/e2e/issuer/test_connections_use_public_did.py +++ b/app/tests/e2e/issuer/test_connections_use_public_did.py @@ -6,7 +6,7 @@ from app.tests.util.webhooks import check_webhook_state from shared import RichAsyncClient -BASE_PATH = router.prefix +CONNECTIONS_BASE_PATH = router.prefix @pytest.mark.anyio @@ -17,7 +17,7 @@ async def test_accept_use_public_did( invite_json = CreateInvitation(use_public_did=True).model_dump() response = await faber_client.post( - f"{BASE_PATH}/create-invitation", json=invite_json + f"{CONNECTIONS_BASE_PATH}/create-invitation", json=invite_json ) assert response.status_code == 200 @@ -33,7 +33,7 @@ async def test_accept_use_public_did( ).model_dump() accept_response = await meld_co_client.post( - f"{BASE_PATH}/accept-invitation", + f"{CONNECTIONS_BASE_PATH}/accept-invitation", json=accept_invite_json, ) connection_record = accept_response.json() @@ -61,7 +61,7 @@ async def test_accept_use_public_did_between_issuer_and_holder( invite_json = CreateInvitation(use_public_did=True).model_dump() response = await faber_client.post( - f"{BASE_PATH}/create-invitation", json=invite_json + f"{CONNECTIONS_BASE_PATH}/create-invitation", json=invite_json ) assert response.status_code == 200 @@ -77,7 +77,7 @@ async def test_accept_use_public_did_between_issuer_and_holder( ).model_dump() accept_response = await alice_member_client.post( - f"{BASE_PATH}/accept-invitation", + f"{CONNECTIONS_BASE_PATH}/accept-invitation", json=accept_invite_json, ) connection_record = accept_response.json() diff --git a/app/tests/e2e/test_connections.py b/app/tests/e2e/test_connections.py index 5ad2bf3eb..263f2fe8e 100644 --- a/app/tests/e2e/test_connections.py +++ b/app/tests/e2e/test_connections.py @@ -11,7 +11,7 @@ from app.tests.util.webhooks import check_webhook_state from shared import RichAsyncClient -BASE_PATH = router.prefix +CONNECTIONS_BASE_PATH = router.prefix @pytest.mark.anyio @@ -39,7 +39,7 @@ async def test_create_invitation_no_public_did( with pytest.raises(HTTPException) as exc_info: # regular holders cannot `use_public_did` as they do not have a public did await bob_member_client.post( - f"{BASE_PATH}/create-invitation", json=invite_json + f"{CONNECTIONS_BASE_PATH}/create-invitation", json=invite_json ) assert exc_info.value.status_code == 400 assert ( @@ -48,7 +48,7 @@ async def test_create_invitation_no_public_did( ) else: response = await bob_member_client.post( - f"{BASE_PATH}/create-invitation", json=invite_json + f"{CONNECTIONS_BASE_PATH}/create-invitation", json=invite_json ) assert response.status_code == 200 @@ -67,7 +67,9 @@ async def test_accept_invitation( alice_member_client: RichAsyncClient, ): alias = "test_alias" - invitation_response = await bob_member_client.post(f"{BASE_PATH}/create-invitation") + invitation_response = await bob_member_client.post( + f"{CONNECTIONS_BASE_PATH}/create-invitation" + ) invitation = invitation_response.json() accept_invite_json = AcceptInvitation( @@ -76,7 +78,7 @@ async def test_accept_invitation( ).model_dump() accept_response = await alice_member_client.post( - f"{BASE_PATH}/accept-invitation", + f"{CONNECTIONS_BASE_PATH}/accept-invitation", json=accept_invite_json, ) connection_record = accept_response.json() @@ -113,65 +115,71 @@ async def test_get_connections( try: alice_connection = ( - await alice_member_client.get(f"{BASE_PATH}/{alice_connection_id}") + await alice_member_client.get( + f"{CONNECTIONS_BASE_PATH}/{alice_connection_id}" + ) ).json() bob_connection = ( - await bob_member_client.get(f"{BASE_PATH}/{bob_connection_id}") + await bob_member_client.get(f"{CONNECTIONS_BASE_PATH}/{bob_connection_id}") ).json() alice_invitation_msg_id_value = alice_connection["invitation_msg_id"] alice_did = alice_connection["my_did"] alice_connection_alias = ( - await alice_member_client.get(f"{BASE_PATH}?alias={connection_alias}") + await alice_member_client.get( + f"{CONNECTIONS_BASE_PATH}?alias={connection_alias}" + ) ).json()[0]["alias"] assert alice_connection_alias == connection_alias alice_state = ( - await alice_member_client.get(f"{BASE_PATH}?state=completed") + await alice_member_client.get(f"{CONNECTIONS_BASE_PATH}?state=completed") ).json()[0]["state"] assert alice_state == "completed" alice_key = ( await alice_member_client.get( - f"{BASE_PATH}?invitation_key={bob_connection['invitation_key']}" + f"{CONNECTIONS_BASE_PATH}?invitation_key={bob_connection['invitation_key']}" ) ).json()[0]["invitation_key"] assert alice_key == alice_connection["invitation_key"] alice_invitation_msg_id = ( await alice_member_client.get( - f"{BASE_PATH}?invitation_msg_id={alice_invitation_msg_id_value}" + f"{CONNECTIONS_BASE_PATH}?invitation_msg_id={alice_invitation_msg_id_value}" ) ).json()[0]["invitation_msg_id"] assert alice_invitation_msg_id == alice_invitation_msg_id_value alice_my_did = ( - await alice_member_client.get(f"{BASE_PATH}?my_did={alice_did}") + await alice_member_client.get(f"{CONNECTIONS_BASE_PATH}?my_did={alice_did}") ).json()[0]["my_did"] assert alice_my_did == alice_did alice_their_did = ( await alice_member_client.get( - f"{BASE_PATH}?their_did={bob_connection['my_did']}" + f"{CONNECTIONS_BASE_PATH}?their_did={bob_connection['my_did']}" ) ).json()[0]["their_did"] assert alice_their_did == alice_connection["their_did"] with pytest.raises(HTTPException) as exc: await alice_member_client.get( - f"{BASE_PATH}?their_public_did={bob_connection['their_public_did']}" + f"{CONNECTIONS_BASE_PATH}?their_public_did={bob_connection['their_public_did']}" ) assert exc.value.status_code == 422 alice_their_role = ( - await alice_member_client.get(f"{BASE_PATH}?their_role=inviter") + await alice_member_client.get(f"{CONNECTIONS_BASE_PATH}?their_role=inviter") ).json()[0]["their_role"] assert alice_their_role == "inviter" finally: # clean up temp connection - await alice_member_client.delete(f"{BASE_PATH}/{alice_connection_id}") + await alice_member_client.delete( + f"{CONNECTIONS_BASE_PATH}/{alice_connection_id}" + ) @pytest.mark.anyio @@ -188,7 +196,7 @@ async def test_get_connection_by_id( bob_connection_id = bob_and_alice_connection.bob_connection_id try: connection_response = await bob_member_client.get( - f"{BASE_PATH}/{bob_connection_id}" + f"{CONNECTIONS_BASE_PATH}/{bob_connection_id}" ) connection_record = connection_response.json() @@ -198,7 +206,7 @@ async def test_get_connection_by_id( ) assert_that(connection_record).has_alias(connection_alias) finally: - await bob_member_client.delete(f"{BASE_PATH}/{bob_connection_id}") + await bob_member_client.delete(f"{CONNECTIONS_BASE_PATH}/{bob_connection_id}") @pytest.mark.anyio @@ -215,16 +223,22 @@ async def test_delete_connection( bob_connection_id = bob_and_alice_connection.bob_connection_id alice_connection_id = bob_and_alice_connection.alice_connection_id - response = await bob_member_client.delete(f"{BASE_PATH}/{bob_connection_id}") + response = await bob_member_client.delete( + f"{CONNECTIONS_BASE_PATH}/{bob_connection_id}" + ) assert response.status_code == 204 with pytest.raises(HTTPException) as exc: - response = await bob_member_client.get(f"{BASE_PATH}/{bob_connection_id}") + response = await bob_member_client.get( + f"{CONNECTIONS_BASE_PATH}/{bob_connection_id}" + ) assert exc.value.status_code == 404 # Check that the connection is deleted for alice as well with pytest.raises(HTTPException) as exc: - response = await alice_member_client.get(f"{BASE_PATH}/{alice_connection_id}") + response = await alice_member_client.get( + f"{CONNECTIONS_BASE_PATH}/{alice_connection_id}" + ) assert exc.value.status_code == 404 @@ -249,7 +263,7 @@ async def test_get_connections_paginated( retry = True while retry and num_tries < 5: # Handle case where record doesn't exist yet response = await alice_member_client.get( - BASE_PATH, + CONNECTIONS_BASE_PATH, params={ "alias": test_alias, "limit": limit, @@ -269,7 +283,7 @@ async def test_get_connections_paginated( # Test ascending order response = await alice_member_client.get( - BASE_PATH, + CONNECTIONS_BASE_PATH, params={ "alias": test_alias, "limit": num_connections_to_test, @@ -286,7 +300,7 @@ async def test_get_connections_paginated( # Test descending order response = await alice_member_client.get( - BASE_PATH, + CONNECTIONS_BASE_PATH, params={ "alias": test_alias, "limit": num_connections_to_test, @@ -308,7 +322,7 @@ async def test_get_connections_paginated( # Test offset greater than number of records response = await alice_member_client.get( - BASE_PATH, + CONNECTIONS_BASE_PATH, params={ "alias": test_alias, "limit": 1, @@ -322,7 +336,7 @@ async def test_get_connections_paginated( prev_connections = [] for offset in range(num_connections_to_test): response = await alice_member_client.get( - BASE_PATH, + CONNECTIONS_BASE_PATH, params={ "alias": test_alias, "limit": 1, @@ -347,10 +361,12 @@ async def test_get_connections_paginated( for params in invalid_params: with pytest.raises(HTTPException) as exc: - await alice_member_client.get(BASE_PATH, params=params) + await alice_member_client.get(CONNECTIONS_BASE_PATH, params=params) assert exc.value.status_code == 422 finally: # Clean up connections for conn in bob_alice_connections: - await alice_member_client.delete(f"{BASE_PATH}/{conn.alice_connection_id}") + await alice_member_client.delete( + f"{CONNECTIONS_BASE_PATH}/{conn.alice_connection_id}" + ) diff --git a/app/tests/e2e/verifier/test_verifier.py b/app/tests/e2e/verifier/test_verifier.py index 1015db1cc..d872a93bd 100644 --- a/app/tests/e2e/verifier/test_verifier.py +++ b/app/tests/e2e/verifier/test_verifier.py @@ -7,7 +7,6 @@ from aries_cloudcontroller import IndyPresSpec, IndyRequestedCredsRequestedAttr from fastapi import HTTPException -from app.routes.connections import router as conn_router from app.routes.definitions import router as def_router from app.routes.issuer import router as issuer_router from app.routes.oob import router as oob_router @@ -23,7 +22,6 @@ from shared.models.credential_exchange import CredentialExchange from shared.models.presentation_exchange import PresentationExchange -CONNECTIONS_BASE_PATH = conn_router.prefix DEFINITIONS_BASE_PATH = def_router.prefix ISSUER_BASE_PATH = issuer_router.prefix OOB_BASE_PATH = oob_router.prefix