generated from Luis/nextjs-python-web-template
addeding tests: first producer
This commit is contained in:
0
pkgs/clan-cli/clan_cli/webui/tests/test_api.py
Normal file
0
pkgs/clan-cli/clan_cli/webui/tests/test_api.py
Normal file
26
pkgs/clan-cli/clan_cli/webui/tests/test_db_api.py
Normal file
26
pkgs/clan-cli/clan_cli/webui/tests/test_db_api.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import pytest
|
||||||
|
from api import TestClient
|
||||||
|
from fixtures_flakes import FlakeForTest
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def test_producer(api: TestClient, test_flake: FlakeForTest) -> None:
|
||||||
|
request_body = """{
|
||||||
|
"uuid": "8e285c0c-4e40-430a-a477-26b3b81e30df",
|
||||||
|
"service_name": "Carlo's Printing",
|
||||||
|
"service_type": "3D Printing",
|
||||||
|
"endpoint_url": "http://127.0.0.1:8000",
|
||||||
|
"status": "unknown",
|
||||||
|
"other": {
|
||||||
|
"test": "test"
|
||||||
|
},
|
||||||
|
"entity_did": "did:sov:test:1234"
|
||||||
|
}"""
|
||||||
|
response = api.post(f"/api/v1/create_producer", json=request_body)
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert response.json() == request_body
|
||||||
|
response = api.get(
|
||||||
|
f"api/v1/get_producer?entity_did=did%3Asov%3Atest%3A1234&skip=0&limit=100", json={}
|
||||||
|
)
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert response.json() == request_body
|
||||||
Reference in New Issue
Block a user