def test_save_node_with_dict_parameter(self): node = Node("node") d = {"a": 1, "b": 2, "c": 3} node.create_parameter("dict", d) node.flatten() node.expand() node.save() retrieved = Node.objects.get(name="node") self.assertEqual(retrieved.get_parameter("dict").expanded_value, d)
def test_save_node_with_string_macro(self): node = Node("node") node.create_parameter("p1", "v1") node.create_parameter("p2", "${p1}") node.flatten() node.expand() node.save() retrieved = Node.objects.get(name="node") self.assertEqual(retrieved.get_parameter("p1").expanded_value, retrieved.get_parameter("p2").expanded_value)
def test_save_node_with_list_parameter2(self): node = Node("node") l = [1, "b", 3] node.create_parameter("list", l) node.flatten() node.expand() node.save() retrieved = Node.objects.get(name="node") self.assertEqual(retrieved.get_parameter("list").expanded_value, l)
def test_save_node_with_macro_in_list(self): node = Node("node") l = [1, "b", "${p1}"] node.create_parameter("list", l) node.create_parameter("p1", 3) node.flatten() node.expand() node.save() retrieved = Node.objects.get(name="node") self.assertEqual(retrieved.get_parameter("list").expanded_value[2], "3")
def test_save_node(self): node = Node("node") node.save() retrieved = Node.objects.get(name="node") self.assertEqual(node, retrieved)