本文整理汇总了Python中ariane_clip3.mapping.Node.add_twin_node方法的典型用法代码示例。如果您正苦于以下问题:Python Node.add_twin_node方法的具体用法?Python Node.add_twin_node怎么用?Python Node.add_twin_node使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ariane_clip3.mapping.Node
的用法示例。
在下文中一共展示了Node.add_twin_node方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_twin_nodes_link
# 需要导入模块: from ariane_clip3.mapping import Node [as 别名]
# 或者: from ariane_clip3.mapping.Node import add_twin_node [as 别名]
def test_twin_nodes_link(self):
container2 = Container(name="test_twin_nodes_link_container2",
gate_uri="ssh://my_host/docker/test_twin_nodes_link_container2",
primary_admin_gate_name="container name space (pid)", company="Docker",
product="Docker", c_type="container")
node_mysql1 = Node(name="mysqld1", container=self.container1)
node_mysql2 = Node(name="mysqld2", container=container2)
node_mysql1.add_twin_node(node_mysql2, sync=False)
self.assertTrue(node_mysql2 in node_mysql1.twin_nodes_2_add)
node_mysql1.save()
self.assertFalse(node_mysql2 in node_mysql1.twin_nodes_2_add)
self.assertTrue(node_mysql2.id in node_mysql1.twin_nodes_id)
self.assertTrue(node_mysql1.id in node_mysql2.twin_nodes_id)
node_mysql2.del_twin_node(node_mysql1, sync=False)
self.assertTrue(node_mysql1 in node_mysql2.twin_nodes_2_rm)
self.assertTrue(node_mysql2.id in node_mysql1.twin_nodes_id)
self.assertTrue(node_mysql1.id in node_mysql2.twin_nodes_id)
node_mysql2.save()
self.assertFalse(node_mysql1 in node_mysql2.twin_nodes_2_rm)
self.assertFalse(node_mysql2.id in node_mysql1.twin_nodes_id)
self.assertFalse(node_mysql1.id in node_mysql2.twin_nodes_id)
node_mysql1.add_twin_node(node_mysql2)
self.assertTrue(node_mysql2.id in node_mysql1.twin_nodes_id)
self.assertTrue(node_mysql1.id in node_mysql2.twin_nodes_id)
node_mysql2.del_twin_node(node_mysql1)
self.assertFalse(node_mysql2.id in node_mysql1.twin_nodes_id)
self.assertFalse(node_mysql1.id in node_mysql2.twin_nodes_id)
node_mysql1.remove()
node_mysql2.remove()
container2.remove()