generated from Luis/nextjs-python-web-template
first running test for db
This commit is contained in:
33
pkgs/clan-cli/tests/test_db_api.py
Normal file
33
pkgs/clan-cli/tests/test_db_api.py
Normal 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]
|
||||
Reference in New Issue
Block a user