Skip to content

Commit

Permalink
add not found tests for point endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
TShapinsky committed Dec 29, 2023
1 parent 7b77a08 commit e8bd6ad
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions tests/api/test_point.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from datetime import datetime
from uuid import uuid4

import pytest
import requests
Expand Down Expand Up @@ -204,3 +205,67 @@ def test_point_writes(base_url, run_id):
assert "payload" in response_body
payload = response_body["payload"]
assert len(payload) == len(outputs), "Error cardinality mismatch"


@pytest.mark.api
def test_point_not_found(base_url, run_id):
# request point which does not exist
response = requests.get(f"{base_url}/runs/{run_id}/points/{uuid4()}")

assert response.status_code == 404
response_body = response.json()
assert "message" in response_body

# write point which does not exist
request_body = {
'value': 5
}
response = requests.put(f"{base_url}/runs/{run_id}/points/{uuid4()}", json=request_body)

assert response.status_code == 404
response_body = response.json()
assert "message" in response_body

# request points for run which does not exist
response = requests.get(f"{base_url}/runs/{uuid4()}/points")

assert response.status_code == 404
response_body = response.json()
assert "message" in response_body

# request certain points for run which does not exist
request_body = {
'pointTypes': ["OUTPUT"]
}
response = requests.post(f"{base_url}/runs/{uuid4()}/points", json=request_body)

assert response.status_code == 404
response_body = response.json()
assert "message" in response_body

# request point values for run which does not exist
response = requests.get(f"{base_url}/runs/{uuid4()}/points/values")

assert response.status_code == 404
response_body = response.json()
assert "message" in response_body

# request certain point values for run which does not exist
request_body = {
'pointTypes': ["INPUT"]
}
response = requests.post(f"{base_url}/runs/{uuid4()}/points/values", json=request_body)

assert response.status_code == 404
response_body = response.json()
assert "message" in response_body

# write point values for run which does not exist
request_body = {
'point_name': 10
}
response = requests.put(f"{base_url}/runs/{uuid4()}/points/values", json=request_body)

assert response.status_code == 404
response_body = response.json()
assert "message" in response_body

0 comments on commit e8bd6ad

Please sign in to comment.