summaryrefslogtreecommitdiff
path: root/ironic/tests/unit/db/test_bios_settings.py
diff options
context:
space:
mode:
authorZenghui Shi <zshi@redhat.com>2018-06-01 16:49:09 +0800
committerZenghui Shi <zshi@redhat.com>2018-06-20 15:15:01 +0800
commitb17c5280e1b750ea5cdaf72ad81cf74675676d7c (patch)
treeec64729316b8e23bd4a9d26375c9592dd4bb6d9e /ironic/tests/unit/db/test_bios_settings.py
parent585427ab8ec188c82562c20feace22f868eea532 (diff)
downloadironic-b17c5280e1b750ea5cdaf72ad81cf74675676d7c.tar.gz
BIOS Settings: add sync_node_setting
sync_node_setting takes a list of bios settings as input and sorts out a tuple of lists of create, update, delete and nochange settings by comparing the given settings with node 'bios_settings' database table. This commit also modifies fake BIOS interface to use sync_node_setting for testing purpose. Change-Id: I831b3db8f4da24d88a81b4d85889f7fd6f83ffdb Story: #1712032
Diffstat (limited to 'ironic/tests/unit/db/test_bios_settings.py')
-rw-r--r--ironic/tests/unit/db/test_bios_settings.py45
1 files changed, 27 insertions, 18 deletions
diff --git a/ironic/tests/unit/db/test_bios_settings.py b/ironic/tests/unit/db/test_bios_settings.py
index 5e6814659..684c307b2 100644
--- a/ironic/tests/unit/db/test_bios_settings.py
+++ b/ironic/tests/unit/db/test_bios_settings.py
@@ -58,24 +58,6 @@ class DbBIOSSettingTestCase(base.DbTestCase):
self.dbapi.get_bios_setting_list,
'456')
- def test_delete_bios_setting(self):
- db_utils.create_test_bios_setting(node_id=self.node.id)
- self.dbapi.delete_bios_setting(self.node.id, 'virtualization')
- self.assertRaises(exception.BIOSSettingNotFound,
- self.dbapi.get_bios_setting,
- self.node.id, 'virtualization')
-
- def test_delete_bios_setting_node_not_exist(self):
- self.assertRaises(exception.NodeNotFound,
- self.dbapi.delete_bios_setting,
- '456', 'virtualization')
-
- def test_delete_bios_setting_setting_not_exist(self):
- db_utils.create_test_bios_setting(node_id=self.node.id)
- self.assertRaises(exception.BIOSSettingNotFound,
- self.dbapi.delete_bios_setting,
- self.node.id, 'hyperthread')
-
def test_create_bios_setting_list(self):
settings = db_utils.get_test_bios_setting_setting_list()
result = self.dbapi.create_bios_setting_list(
@@ -121,3 +103,30 @@ class DbBIOSSettingTestCase(base.DbTestCase):
self.assertRaises(exception.NodeNotFound,
self.dbapi.update_bios_setting_list,
'456', [], '1.0')
+
+ def test_delete_bios_setting_list(self):
+ settings = db_utils.get_test_bios_setting_setting_list()
+ self.dbapi.create_bios_setting_list(self.node.id, settings, '1.0')
+ name_list = [setting['name'] for setting in settings]
+ self.dbapi.delete_bios_setting_list(self.node.id, name_list)
+ self.assertRaises(exception.BIOSSettingNotFound,
+ self.dbapi.get_bios_setting,
+ self.node.id, 'virtualization')
+ self.assertRaises(exception.BIOSSettingNotFound,
+ self.dbapi.get_bios_setting,
+ self.node.id, 'hyperthread')
+ self.assertRaises(exception.BIOSSettingNotFound,
+ self.dbapi.get_bios_setting,
+ self.node.id, 'numlock')
+
+ def test_delete_bios_setting_list_node_not_exist(self):
+ self.assertRaises(exception.NodeNotFound,
+ self.dbapi.delete_bios_setting_list,
+ '456', ['virtualization'])
+
+ def test_delete_bios_setting_list_setting_not_exist(self):
+ settings = db_utils.get_test_bios_setting_setting_list()
+ self.dbapi.create_bios_setting_list(self.node.id, settings, '1.0')
+ self.assertRaises(exception.BIOSSettingListNotFound,
+ self.dbapi.delete_bios_setting_list,
+ self.node.id, ['fake-bios-option'])