Exemple #1
0
def get_test_bios_setting(ctxt, **kw):
    """Return a BiosSettingList object with appropriate attributes.

    NOTE: The object leaves the attributes marked as changed, such
    that a create() could be used to commit it to the DB.
    """
    kw['object_type'] = 'bios'
    db_bios_setting = db_utils.get_test_bios_setting(**kw)
    bios_setting = objects.BIOSSetting(ctxt)
    for key in db_bios_setting:
        setattr(bios_setting, key, db_bios_setting[key])
    return bios_setting
Exemple #2
0
def get_test_bios_setting(ctxt, **kw):
    """Return a BiosSettingList object with appropriate attributes.

    NOTE: The object leaves the attributes marked as changed, such
    that a create() could be used to commit it to the DB.
    """
    kw['object_type'] = 'bios'
    db_bios_setting = db_utils.get_test_bios_setting(**kw)
    bios_setting = objects.BIOSSetting(ctxt)
    for key in db_bios_setting:
        setattr(bios_setting, key, db_bios_setting[key])
    return bios_setting
Exemple #3
0
    def test_get_by_node_id(self, mock_get_setting_list):
        bios_setting2 = db_utils.get_test_bios_setting(name='hyperthread',
                                                       value='enabled')
        mock_get_setting_list.return_value = [self.bios_setting, bios_setting2]
        bios_obj_list = objects.BIOSSettingList.get_by_node_id(
            self.context, self.node_id)

        mock_get_setting_list.assert_called_once_with(self.node_id)
        self.assertEqual(self.context, bios_obj_list._context)
        self.assertEqual(2, len(bios_obj_list))
        self.assertEqual(self.bios_setting['node_id'],
                         bios_obj_list[0].node_id)
        self.assertEqual(self.bios_setting['name'], bios_obj_list[0].name)
        self.assertEqual(self.bios_setting['value'], bios_obj_list[0].value)
        self.assertEqual(bios_setting2['node_id'], bios_obj_list[1].node_id)
        self.assertEqual(bios_setting2['name'], bios_obj_list[1].name)
        self.assertEqual(bios_setting2['value'], bios_obj_list[1].value)
    def test_get_by_node_id(self, mock_get_setting_list):
        bios_setting2 = db_utils.get_test_bios_setting(name='hyperthread',
                                                       value='enabled')
        mock_get_setting_list.return_value = [self.bios_setting, bios_setting2]
        bios_obj_list = objects.BIOSSettingList.get_by_node_id(
            self.context, self.node_id)

        mock_get_setting_list.assert_called_once_with(self.node_id)
        self.assertEqual(self.context, bios_obj_list._context)
        self.assertEqual(2, len(bios_obj_list))
        self.assertEqual(self.bios_setting['node_id'],
                         bios_obj_list[0].node_id)
        self.assertEqual(self.bios_setting['name'], bios_obj_list[0].name)
        self.assertEqual(self.bios_setting['value'], bios_obj_list[0].value)
        self.assertEqual(bios_setting2['node_id'], bios_obj_list[1].node_id)
        self.assertEqual(bios_setting2['name'], bios_obj_list[1].name)
        self.assertEqual(bios_setting2['value'], bios_obj_list[1].value)
Exemple #5
0
 def setUp(self):
     super(TestBIOSSettingObject, self).setUp()
     self.ctxt = context.get_admin_context()
     self.bios_setting = db_utils.get_test_bios_setting()
     self.node_id = self.bios_setting['node_id']
Exemple #6
0
 def test_list_delete(self, mock_delete):
     bios_setting2 = db_utils.get_test_bios_setting(name='hyperthread')
     name_list = [self.bios_setting['name'], bios_setting2['name']]
     objects.BIOSSettingList.delete(self.context, self.node_id, name_list)
     mock_delete.assert_called_once_with(self.node_id, name_list)
 def setUp(self):
     super(TestBIOSSettingObject, self).setUp()
     self.ctxt = context.get_admin_context()
     self.bios_setting = db_utils.get_test_bios_setting()
     self.node_id = self.bios_setting['node_id']
 def test_list_delete(self, mock_delete):
     bios_setting2 = db_utils.get_test_bios_setting(name='hyperthread')
     name_list = [self.bios_setting['name'], bios_setting2['name']]
     objects.BIOSSettingList.delete(self.context, self.node_id, name_list)
     mock_delete.assert_called_once_with(self.node_id, name_list)