예제 #1
0
 def test_save_system_with_node(self):
   system = System("system")
   system.create_node("node")
   system.save()
   retrieved = System.objects.get(name="system")
   self.assertEqual(system, retrieved)
   self.assertEqual(system.nodes, retrieved.nodes)
   self.assertTrue(retrieved.nodes.has_key("node"))
예제 #2
0
 def test_save_system_without_node(self):
   system = System("system")
   system.save()
   retrieved = System.objects.get(name="system")
   self.assertEqual(system, retrieved)
   self.assertEqual(system.name, retrieved.name)
예제 #3
0
 def test_create_node_twice(self):
   s = System("system")
   n = s.create_node("node")
   self.assertRaises(DuplicateError, s.create_node, "node") 
예제 #4
0
 def test_delete_node_base(self):
   s = System("system")
   n = s.create_node("node")
   s.delete_node("node")
   self.assertFalse("node" in  s.nodes)
예제 #5
0
 def test_create_node_base(self):
   s = System("system")
   n = s.create_node("node")
   self.assertEqual(n.name, "node")
   self.assertTrue(n is s.nodes["node"])