def test_no_sites(self): cfg = facade.Facade({ "local": { "role": DrRole.PRIMARY.value, }, "remote_sites": [], }) self.assertEqual(cfg.get_remote_site_list(), [])
def test_local_role(self): for role in DrRole: with self.subTest(local_role=role.value): cfg = facade.Facade({ "local": { "role": role.value, }, "remote_sites": [], }) self.assertEqual(cfg.local_role, role)
def test_no_nodes(self): cfg = facade.Facade({ "local": { "role": DrRole.PRIMARY.value, }, "remote_sites": [ { "role": DrRole.RECOVERY.value, "nodes": [], }, ], }) self.assertEqual(cfg.get_remote_site_list(), [ facade.DrSite(role=DrRole.RECOVERY, node_name_list=[]), ])
def test_more_sites(self): cfg = facade.Facade({ "local": { "role": DrRole.RECOVERY.value, }, "remote_sites": [ { "role": DrRole.PRIMARY.value, "nodes": [ { "name": "nodeA1" }, { "name": "nodeA2" }, ], }, { "role": DrRole.RECOVERY.value, "nodes": [ { "name": "nodeB1" }, { "name": "nodeB2" }, ], }, ], }) self.assertEqual( cfg.get_remote_site_list(), [ facade.DrSite(role=DrRole.PRIMARY, node_name_list=["nodeA1", "nodeA2"]), facade.DrSite(role=DrRole.RECOVERY, node_name_list=["nodeB1", "nodeB2"]), ], )