Add a list of children nodes unit test

Somehow, missed adding a test for this early on, while working on
validating the API client changes, I discovered that we seemed to
be missing unit tests for the method, because I couldn't get it
to work for the client, but then I realized I was just mixing
the nature of use up. C'est la vie!

Change-Id: I382ad3a011f3151abedb896f58c75e8b76b357fa
This commit is contained in:
Julia Kreger 2023-07-26 11:30:37 -07:00
parent 40356e2eae
commit 81b35931d4

@ -8372,6 +8372,16 @@ class TestNodeChildrenTestCase(test_api_base.BaseApiTest):
'/nodes/?parent_node={}'.format(node.uuid), headers=self.headers)
self.assertEqual(0, len(response['nodes']))
def test_list_node_children_by_single_node(self):
obj_utils.create_test_node(
self.context,
uuid=uuidutils.generate_uuid(),
name='kryze',
parent_node=self.node.uuid)
response = self.get_json(
'/nodes/{}/children'.format(self.node.uuid), headers=self.headers)
self.assertEqual(2, len(response['children']))
@mock.patch.object(rpcapi.ConductorAPI, 'create_node',
lambda _api, _ctx, node, _topic: _create_node_locally(node))