summaryrefslogtreecommitdiff
path: root/ironic/tests/unit/api/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'ironic/tests/unit/api/controllers')
-rw-r--r--ironic/tests/unit/api/controllers/v1/test_allocation.py14
-rw-r--r--ironic/tests/unit/api/controllers/v1/test_conductor.py12
-rw-r--r--ironic/tests/unit/api/controllers/v1/test_deploy_template.py13
-rw-r--r--ironic/tests/unit/api/controllers/v1/test_node.py10
-rw-r--r--ironic/tests/unit/api/controllers/v1/test_port.py5
5 files changed, 40 insertions, 14 deletions
diff --git a/ironic/tests/unit/api/controllers/v1/test_allocation.py b/ironic/tests/unit/api/controllers/v1/test_allocation.py
index 39a12784e..60fcca0dc 100644
--- a/ironic/tests/unit/api/controllers/v1/test_allocation.py
+++ b/ironic/tests/unit/api/controllers/v1/test_allocation.py
@@ -192,7 +192,9 @@ class TestListAllocations(test_api_base.BaseApiTest):
self.assertEqual(3, len(data['allocations']))
next_marker = data['allocations'][-1]['uuid']
- self.assertIn(next_marker, data['next'])
+ self.assertIn('/allocations', data['next'])
+ self.assertIn('limit=3', data['next'])
+ self.assertIn(f'marker={next_marker}', data['next'])
def test_collection_links_default_limit(self):
cfg.CONF.set_override('max_limit', 3, 'api')
@@ -207,7 +209,10 @@ class TestListAllocations(test_api_base.BaseApiTest):
self.assertEqual(3, len(data['allocations']))
next_marker = data['allocations'][-1]['uuid']
- self.assertIn(next_marker, data['next'])
+ self.assertIn('/allocations', data['next'])
+ # FIXME(dtantsur): IMO this should not pass, but it does now
+ self.assertIn('limit=3', data['next'])
+ self.assertIn(f'marker={next_marker}', data['next'])
def test_collection_links_custom_fields(self):
cfg.CONF.set_override('max_limit', 3, 'api')
@@ -227,8 +232,9 @@ class TestListAllocations(test_api_base.BaseApiTest):
self.assertEqual(3, len(data['allocations']))
next_marker = data['allocations'][-1]['uuid']
- self.assertIn(next_marker, data['next'])
- self.assertIn('fields', data['next'])
+ self.assertIn('/allocations', data['next'])
+ self.assertIn(f'marker={next_marker}', data['next'])
+ self.assertIn(f'fields={fields}', data['next'])
def test_get_collection_pagination_no_uuid(self):
fields = 'node_uuid'
diff --git a/ironic/tests/unit/api/controllers/v1/test_conductor.py b/ironic/tests/unit/api/controllers/v1/test_conductor.py
index caf85eb4c..d5e54ee1b 100644
--- a/ironic/tests/unit/api/controllers/v1/test_conductor.py
+++ b/ironic/tests/unit/api/controllers/v1/test_conductor.py
@@ -188,7 +188,9 @@ class TestListConductors(test_api_base.BaseApiTest):
self.assertEqual(3, len(data['conductors']))
next_marker = data['conductors'][-1]['hostname']
- self.assertIn(next_marker, data['next'])
+ self.assertIn('/conductors', data['next'])
+ self.assertIn('limit=3', data['next'])
+ self.assertIn(f'marker={next_marker}', data['next'])
def test_collection_links_default_limit(self):
cfg.CONF.set_override('max_limit', 3, 'api')
@@ -204,7 +206,8 @@ class TestListConductors(test_api_base.BaseApiTest):
self.assertEqual(3, len(data['conductors']))
next_marker = data['conductors'][-1]['hostname']
- self.assertIn(next_marker, data['next'])
+ self.assertIn('/conductors', data['next'])
+ self.assertIn(f'marker={next_marker}', data['next'])
def test_collection_links_custom_fields(self):
cfg.CONF.set_override('max_limit', 3, 'api')
@@ -221,8 +224,9 @@ class TestListConductors(test_api_base.BaseApiTest):
self.assertEqual(3, len(data['conductors']))
next_marker = data['conductors'][-1]['hostname']
- self.assertIn(next_marker, data['next'])
- self.assertIn('fields', data['next'])
+ self.assertIn('/conductors', data['next'])
+ self.assertIn(f'marker={next_marker}', data['next'])
+ self.assertIn(f'fields={fields}', data['next'])
def test_sort_key(self):
conductors = []
diff --git a/ironic/tests/unit/api/controllers/v1/test_deploy_template.py b/ironic/tests/unit/api/controllers/v1/test_deploy_template.py
index ed7239d5c..b86fb0b1d 100644
--- a/ironic/tests/unit/api/controllers/v1/test_deploy_template.py
+++ b/ironic/tests/unit/api/controllers/v1/test_deploy_template.py
@@ -210,7 +210,9 @@ class TestListDeployTemplates(BaseDeployTemplatesAPITest):
self.assertEqual(3, len(data['deploy_templates']))
next_marker = data['deploy_templates'][-1]['uuid']
- self.assertIn(next_marker, data['next'])
+ self.assertIn('/deploy_templates', data['next'])
+ self.assertIn('limit=3', data['next'])
+ self.assertIn(f'marker={next_marker}', data['next'])
def test_collection_links_default_limit(self):
cfg.CONF.set_override('max_limit', 3, 'api')
@@ -224,7 +226,8 @@ class TestListDeployTemplates(BaseDeployTemplatesAPITest):
self.assertEqual(3, len(data['deploy_templates']))
next_marker = data['deploy_templates'][-1]['uuid']
- self.assertIn(next_marker, data['next'])
+ self.assertIn('/deploy_templates', data['next'])
+ self.assertIn(f'marker={next_marker}', data['next'])
def test_collection_links_custom_fields(self):
cfg.CONF.set_override('max_limit', 3, 'api')
@@ -240,8 +243,9 @@ class TestListDeployTemplates(BaseDeployTemplatesAPITest):
headers=self.headers)
self.assertEqual(3, len(data['deploy_templates']))
next_marker = data['deploy_templates'][-1]['uuid']
- self.assertIn(next_marker, data['next'])
- self.assertIn('fields', data['next'])
+ self.assertIn('/deploy_templates', data['next'])
+ self.assertIn(f'marker={next_marker}', data['next'])
+ self.assertIn(f'fields={fields}', data['next'])
def test_get_collection_pagination_no_uuid(self):
fields = 'name'
@@ -259,6 +263,7 @@ class TestListDeployTemplates(BaseDeployTemplatesAPITest):
headers=self.headers)
self.assertEqual(limit, len(data['deploy_templates']))
+ self.assertIn('/deploy_templates', data['next'])
self.assertIn('marker=%s' % templates[limit - 1].uuid, data['next'])
def test_sort_key(self):
diff --git a/ironic/tests/unit/api/controllers/v1/test_node.py b/ironic/tests/unit/api/controllers/v1/test_node.py
index ee957178c..3c913834e 100644
--- a/ironic/tests/unit/api/controllers/v1/test_node.py
+++ b/ironic/tests/unit/api/controllers/v1/test_node.py
@@ -7841,6 +7841,10 @@ class TestNodeHistory(test_api_base.BaseApiTest):
self.assertEqual(1, len(entries))
result_uuid = entries[0]['uuid']
self.assertEqual(self.event1.uuid, result_uuid)
+ self.assertIn('next', ret)
+ self.assertIn('nodes/%s/history' % self.node.uuid, ret['next'])
+ self.assertIn('limit=1', ret['next'])
+ self.assertIn('marker=%s' % result_uuid, ret['next'])
# Second request
ret = self.get_json('/nodes/%s/history?limit=1&marker=%s' %
(self.node.uuid, result_uuid),
@@ -7850,6 +7854,9 @@ class TestNodeHistory(test_api_base.BaseApiTest):
self.assertEqual(1, len(entries))
result_uuid = entries[0]['uuid']
self.assertEqual(self.event2.uuid, result_uuid)
+ self.assertIn('nodes/%s/history' % self.node.uuid, ret['next'])
+ self.assertIn('limit=1', ret['next'])
+ self.assertIn('marker=%s' % result_uuid, ret['next'])
# Third request
ret = self.get_json('/nodes/%s/history?limit=1&marker=%s' %
(self.node.uuid, result_uuid),
@@ -7859,3 +7866,6 @@ class TestNodeHistory(test_api_base.BaseApiTest):
self.assertEqual(1, len(entries))
result_uuid = entries[0]['uuid']
self.assertEqual(self.event3.uuid, result_uuid)
+ self.assertIn('nodes/%s/history' % self.node.uuid, ret['next'])
+ self.assertIn('limit=1', ret['next'])
+ self.assertIn('marker=%s' % result_uuid, ret['next'])
diff --git a/ironic/tests/unit/api/controllers/v1/test_port.py b/ironic/tests/unit/api/controllers/v1/test_port.py
index 1f3322acc..36c024158 100644
--- a/ironic/tests/unit/api/controllers/v1/test_port.py
+++ b/ironic/tests/unit/api/controllers/v1/test_port.py
@@ -194,7 +194,8 @@ class TestPortsController__GetPortsCollection(base.TestCase):
mock_request.context = 'fake-context'
mock_list.return_value = []
self.controller._get_ports_collection(None, None, None, None, None,
- None, 'asc')
+ None, 'asc',
+ resource_url='ports')
mock_list.assert_called_once_with('fake-context', 1000, None,
project=None, sort_dir='asc',
sort_key=None)
@@ -1093,7 +1094,7 @@ class TestListPorts(test_api_base.BaseApiTest):
autospec=True)
def test_detail_with_incorrect_api_usage(self, mock_gpc):
mock_gpc.return_value = api_port.list_convert_with_links(
- [], 0)
+ [], 0, 'port')
# GET /v1/ports/detail specifying node and node_uuid. In this case
# we expect the node_uuid interface to be used.
self.get_json('/ports/detail?node=%s&node_uuid=%s' %