diff --git a/pkgs/clan-cli/tests/test_db_api.py b/pkgs/clan-cli/tests/test_db_api.py index 581ef7c..eb1f574 100644 --- a/pkgs/clan-cli/tests/test_db_api.py +++ b/pkgs/clan-cli/tests/test_db_api.py @@ -1,4 +1,5 @@ import json +from typing import Collection, Iterable, Mapping, Union from api import TestClient @@ -6,7 +7,16 @@ default_entity_did_url = "entity_did=did%3Asov%3Atest%3A1234" default_entity_did = "did:sov:test:1234" -def assert_extra_info(infos: list(), request_body: dict(), response: dict()) -> None: +def assert_extra_info( + infos: list[str], + request_body: Union[ + dict[str, object], + dict[str, Collection[str]], + Mapping[str, Union[str, Iterable[str]]], + ], + response: dict[str, str], +) -> None: + # print(type()) for info in infos: assert info in response.keys() # TODO maybe check the content of the extra info ... @@ -15,12 +25,20 @@ def assert_extra_info(infos: list(), request_body: dict(), response: dict()) -> def make_test_post_and_get( - api: TestClient, request_body: dict(), paramter: str, get_request=default_entity_did_url: str, apiversion="v1": str + api: TestClient, + request_body: Union[ + dict[str, object], + dict[str, Collection[str]], + Mapping[str, Union[str, Iterable[str]]], + ], + paramter: str, + get_request: str = default_entity_did_url, + apiversion: str = "v1", ) -> None: # test post response = api.post( f"/api/{apiversion}/create_{paramter}", - data=json.dumps(request_body), + data={"data": json.dumps(request_body)}, headers={"Content-Type": "application/json"}, ) assert response.status_code == 200