示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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)
示例#4
0
 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")
示例#5
0
 def test_save_node(self):
   node = Node("node")
   node.save()
   retrieved = Node.objects.get(name="node")
   self.assertEqual(node, retrieved)