Пример #1
0
    def test_update_asymmetrical_option_raises_without_install_set(self, sets):
        manager = ObjectsManager(sets)
        obj_index = manager.create(self.options)

        with self.assertRaises(ValueError):
            manager.update(obj_index, 'target', '/dev/sdb')

        for set_index in range(sets):
            obj = manager.get(obj_index=obj_index, set_index=set_index)
            self.assertEqual(obj['target'], '/dev/sda')
Пример #2
0
    def test_can_update_symmetrical_object_option(self, sets):
        manager = ObjectsManager(sets)
        obj_index = manager.create(self.options)
        for set_index in range(sets):
            obj = manager.get(obj_index=obj_index, set_index=set_index)
            self.assertEqual(obj.filename, __file__)

        manager.update(obj_index=obj_index,
                       option='filename',
                       value='new-filename')

        for set_index in range(sets):
            obj = manager.get(obj_index=obj_index, set_index=set_index)
            self.assertEqual(obj.filename, 'new-filename')
Пример #3
0
    def test_can_update_asymmetrical_object_option(self, sets):
        manager = ObjectsManager(sets)
        obj_index = manager.create(self.options)
        for set_index in range(sets):
            obj = manager.get(obj_index=obj_index, set_index=set_index)
            self.assertEqual(obj['target'], '/dev/sda')

        manager.update(obj_index=obj_index,
                       set_index=0,
                       option='target',
                       value='/dev/sdb')

        for set_index in range(sets):
            obj = manager.get(obj_index=obj_index, set_index=set_index)
            if set_index == 0:
                self.assertEqual(obj['target'], '/dev/sdb')
            else:
                self.assertEqual(obj['target'], '/dev/sda')