Merge branch 'main' of ssh://gitea.gchq.icu:7171/IoSL/service-aware-frontend

This commit is contained in:
Georg-Stahn
2023-12-11 19:31:18 +01:00
28 changed files with 580 additions and 180 deletions

View File

@@ -38,8 +38,11 @@ def make_test_post_and_get(
headers={"Content-Type": "application/json"},
)
assert response.status_code == 200
if paramter == "repository":
assert_extra_info(["time_created"], request_body, response.json())
elif paramter == "resolution":
assert_extra_info(["timestamp", "id"], request_body, response.json())
elif paramter == "consumer":
assert_extra_info(["id"], request_body, response.json())
elif paramter == "entity":
@@ -55,6 +58,8 @@ def make_test_post_and_get(
assert response.status_code == 200
if paramter == "repository":
assert_extra_info(["time_created"], request_body, response.json()[0])
elif paramter == "resolution":
assert_extra_info(["timestamp", "id"], request_body, response.json()[0])
elif paramter == "consumer":
assert_extra_info(["id"], request_body, response.json()[0])
elif paramter == "entity":
@@ -77,7 +82,7 @@ def test_producer(api: TestClient) -> None:
"service_type": "3D Printing",
"endpoint_url": "http://127.0.0.1:8000",
"status": "unknown",
"other": {"test": "test"},
"other": {"action": ["register", "deregister", "delete", "create"]},
"entity_did": default_entity_did,
}
paramter = "producer"
@@ -151,7 +156,7 @@ def test_producer2(api: TestClient) -> None:
"service_type": "Fax",
"endpoint_url": "http://127.0.0.1:8001",
"status": "unknown",
"other": {"faxen": "dicke"},
"other": {"action": ["register", "deregister", "delete", "create"]},
"entity_did": default_entity_did2,
}
paramter = "producer"
@@ -166,7 +171,7 @@ def test_producer3(api: TestClient) -> None:
"service_type": "VR-Stream",
"endpoint_url": "http://127.0.0.1:8002",
"status": "unknown",
"other": {"oculos": "rift"},
"other": {"action": ["register", "deregister", "delete", "create"]},
"entity_did": default_entity_did3,
}
paramter = "producer"
@@ -181,7 +186,7 @@ def test_producer4(api: TestClient) -> None:
"service_type": "gallary",
"endpoint_url": "http://127.0.0.1:8003",
"status": "unknown",
"other": {"nice": "pics"},
"other": {"action": ["register", "deregister", "delete", "create"]},
"entity_did": default_entity_did4,
}
paramter = "producer"
@@ -196,7 +201,7 @@ def test_producer5(api: TestClient) -> None:
"service_type": "Game-Shop",
"endpoint_url": "http://127.0.0.1:8004",
"status": "unknown",
"other": {"war": "games"},
"other": {"action": ["register", "deregister", "delete", "create"]},
"entity_did": default_entity_did5,
}
paramter = "producer"
@@ -389,7 +394,11 @@ def test_entity(api: TestClient) -> None:
"name": "C1",
"ip": "127.0.0.1",
"attached": False,
"other": {"test": "test"},
"visible": True,
"other": {
"network": "Carlo1's Home Network",
"roles": ["service repository", "service consumer"],
},
}
paramter = "entity"
# get_request = "entity_did=did%3Asov%3Atest%3A1234"
@@ -402,8 +411,53 @@ def test_entity2(api: TestClient) -> None:
"name": "C2",
"ip": "127.0.0.2",
"attached": False,
"other": {"test": "test"},
"visible": True,
"other": {
"network": "Carlo2's Home Network",
"roles": ["service repository", "service prosumer"],
},
}
paramter = "entity"
get_request = "entity_did=" + url.quote(default_entity_did2)
make_test_post_and_get(api, request_body, paramter, get_request)
#########################
# #
# Resolution #
# #
#########################
def test_resolution(api: TestClient) -> None:
request_body = {
"requester_did": default_entity_did2,
"requester_name": "C2",
"resolved_did": default_entity_did,
"other": {"test": "test"},
}
paramter = "resolution"
get_request = "requester_did=" + url.quote(default_entity_did2)
make_test_post_and_get(api, request_body, paramter, get_request)
def test_resolution2(api: TestClient) -> None:
request_body = {
"requester_did": default_entity_did3,
"requester_name": "C3",
"resolved_did": default_entity_did,
"other": {"test": "test"},
}
paramter = "resolution"
get_request = "requester_did=" + url.quote(default_entity_did3)
make_test_post_and_get(api, request_body, paramter, get_request)
def test_resolution3(api: TestClient) -> None:
request_body = {
"requester_did": default_entity_did4,
"requester_name": "C4",
"resolved_did": default_entity_did,
"other": {"test": "test"},
}
paramter = "resolution"
get_request = "requester_did=" + url.quote(default_entity_did4)
make_test_post_and_get(api, request_body, paramter, get_request)