summaryrefslogtreecommitdiff
path: root/ironic/tests/unit/api/controllers/v1/test_deploy_template.py
diff options
context:
space:
mode:
authorDmitry Tantsur <dtantsur@protonmail.com>2022-01-24 18:33:22 +0100
committerDmitry Tantsur <dtantsur@protonmail.com>2022-02-03 17:30:30 +0000
commitf5615dc815f80c3830a7ddfe341856533223dff5 (patch)
tree4526c9f7da06e01b68595ce752f4cd59b2562ce1 /ironic/tests/unit/api/controllers/v1/test_deploy_template.py
parentf15ae9689dba28b08778bf24ba77f88f57d4ec48 (diff)
downloadironic-f5615dc815f80c3830a7ddfe341856533223dff5.tar.gz
Fix resource_url in the remaining resources
Node history was particularly affected: limit was not converted from string to integer, so "next" link was never added. Add some safeguards to the generic API code. Change-Id: I1328e2f07621bf7e39b96eb4a7ddb66c9a2b65bb (cherry picked from commit 55144d3bd262be35c7a034fea083c3ed73fd63d8)
Diffstat (limited to 'ironic/tests/unit/api/controllers/v1/test_deploy_template.py')
-rw-r--r--ironic/tests/unit/api/controllers/v1/test_deploy_template.py13
1 files changed, 9 insertions, 4 deletions
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):