Skip to content

Commit 4ba533e

Browse files
committed
test: add test
1 parent 6e5e9d4 commit 4ba533e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/backend/tests/unit/api/v1/test_endpoints.py

+27
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,33 @@ async def test_custom_component(client: AsyncClient, logged_in_headers, basic_co
9999
assert "type" in result, "The dictionary must contain a key called 'type'"
100100

101101

102+
async def test_custom_component_update(client: AsyncClient, logged_in_headers, basic_component):
103+
basic_case = basic_component.copy()
104+
basic_case |= {"field": "string", "field_value": "string", "template": {}}
105+
response = await client.post("api/v1/custom_component/update", json=basic_case, headers=logged_in_headers)
106+
result = response.json()
107+
108+
assert response.status_code == status.HTTP_200_OK
109+
assert isinstance(result, dict), "The result must be a dictionary"
110+
assert "template" in result, "The dictionary must contain a key called 'template'"
111+
assert "description" in result, "The dictionary must contain a key called 'description'"
112+
assert "icon" in result, "The dictionary must contain a key called 'icon'"
113+
assert "base_classes" in result, "The dictionary must contain a key called 'base_classes'"
114+
assert "display_name" in result, "The dictionary must contain a key called 'display_name'"
115+
assert "documentation" in result, "The dictionary must contain a key called 'documentation'"
116+
assert "custom_fields" in result, "The dictionary must contain a key called 'custom_fields'"
117+
assert "output_types" in result, "The dictionary must contain a key called 'output_types'"
118+
assert "pinned" in result, "The dictionary must contain a key called 'pinned'"
119+
assert "conditional_paths" in result, "The dictionary must contain a key called 'conditional_paths'"
120+
assert "frozen" in result, "The dictionary must contain a key called 'frozen'"
121+
assert "outputs" in result, "The dictionary must contain a key called 'outputs'"
122+
assert "field_order" in result, "The dictionary must contain a key called 'field_order'"
123+
assert "beta" in result, "The dictionary must contain a key called 'beta'"
124+
assert "legacy" in result, "The dictionary must contain a key called 'legacy'"
125+
assert "edited" in result, "The dictionary must contain a key called 'edited'"
126+
assert "metadata" in result, "The dictionary must contain a key called 'metadata'"
127+
128+
102129
async def test_get_config(client: AsyncClient):
103130
response = await client.get("api/v1/config")
104131
result = response.json()

0 commit comments

Comments
 (0)