diff --git a/tests/test_api/test_nodes.py b/tests/test_api/test_nodes.py index ad932da..c0838bc 100644 --- a/tests/test_api/test_nodes.py +++ b/tests/test_api/test_nodes.py @@ -21,6 +21,19 @@ class TestListNodes: assert data["total"] == 1 assert data["items"][0]["public_key"] == sample_node.public_key assert data["items"][0]["name"] == sample_node.name + assert "tags" in data["items"][0] + + def test_list_nodes_includes_tags( + self, client_no_auth, sample_node, sample_node_tag + ): + """Test listing nodes includes their tags.""" + response = client_no_auth.get("/api/v1/nodes") + assert response.status_code == 200 + data = response.json() + assert len(data["items"]) == 1 + assert len(data["items"][0]["tags"]) == 1 + assert data["items"][0]["tags"][0]["key"] == sample_node_tag.key + assert data["items"][0]["tags"][0]["value"] == sample_node_tag.value def test_list_nodes_pagination(self, client_no_auth, sample_node): """Test node list pagination parameters.""" @@ -54,6 +67,19 @@ class TestGetNode: data = response.json() assert data["public_key"] == sample_node.public_key assert data["name"] == sample_node.name + assert "tags" in data + assert data["tags"] == [] + + def test_get_node_with_tags(self, client_no_auth, sample_node, sample_node_tag): + """Test getting a node includes its tags.""" + response = client_no_auth.get(f"/api/v1/nodes/{sample_node.public_key}") + assert response.status_code == 200 + data = response.json() + assert data["public_key"] == sample_node.public_key + assert "tags" in data + assert len(data["tags"]) == 1 + assert data["tags"][0]["key"] == sample_node_tag.key + assert data["tags"][0]["value"] == sample_node_tag.value def test_get_node_not_found(self, client_no_auth): """Test getting a non-existent node."""