first running test for db

This commit is contained in:
Georg-Stahn
2023-11-27 22:18:45 +01:00
parent 03890360b8
commit 352ab46a6d
5 changed files with 35 additions and 28 deletions

View File

@@ -0,0 +1,33 @@
import pytest
import json
from api import TestClient
#########################
# #
# Producer #
# #
#########################
def test_producer(api: TestClient) -> 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"
}
#test post
response = api.post(f"/api/v1/create_producer",
data=json.dumps(request_body),
headers={"Content-Type": "application/json"})
assert response.status_code == 200
assert response.json() == request_body
#test get
response = api.get(f"api/v1/get_producer?entity_did=did%3Asov%3Atest%3A1234&skip=0&limit=100")
assert response.status_code == 200
assert response.json() == [request_body]