def test_key_creation(self): """ This test checks naming rule for action group """ iteration = 4 test_string = "test_string" a = action.Actions(test_string) a.iteration = iteration self.assertEqual("_".join([str(iteration), test_string]), a.key)
def test_new_step(self): """ This tests checks if action data reset to default after new step """ a = action.Actions("") data = {} a.data = data a.new_step() self.assertNotEqual(a.data, data)
def test_condensation_action(self): a = action.Actions("") vm = mock.Mock(vm_id="uuid") source_node = mock.Mock() source_node.name = "name" target_node = mock.Mock() target_node.name = "name" initial_length = len(a.data[action.CONDENSE]) a.add_condensation_action(vm, source_node, target_node) self.assertEqual(initial_length + 1, len(a.data[action.CONDENSE]))
def __init__(self, name, nodes=None, groups=None): if not nodes: nodes = {} if not groups: groups = [] self.name = name self.add_nodes(nodes) self.groups = groups self.required_flavors_for_nodes = {} self.node_ids_to_be_recalculated = [] self.actions = action.Actions(name) # do we need to solve bounded dynamic knapsacks problem self.improve_accuracy = False LOG.debug("created cloud obj with name " + name)
def test_add_transfer_action(self): a = action.Actions("") initial_length = len(a.data[action.TRANSFER]) a.add_transfer_action("test") self.assertEqual(initial_length + 1, len(a.data[action.TRANSFER]))