def test_metal_ips_kept(self): mi.remove_ip_addresses(self.inv) hostvars = self.inv['_meta']['hostvars'] for host, variables in hostvars.items(): has_networks = 'container_networks' in variables if not variables.get('is_metal', False): continue self.assertTrue(has_networks)
def test_ansible_host_vars_removed(self): mi.remove_ip_addresses(self.inv) hostvars = self.inv['_meta']['hostvars'] for host, variables in hostvars.items(): has_host = 'ansible_host' in variables if variables.get('is_metal', False): continue self.assertFalse(has_host)
def test_ips_removed(self): mi.remove_ip_addresses(self.inv) mi.remove_ip_addresses(self.inv, TARGET_DIR) hostvars = self.inv['_meta']['hostvars'] for host, variables in hostvars.items(): has_networks = 'container_networks' in variables if variables.get('is_metal', False): continue self.assertFalse(has_networks)
def test_multiple_calls(self): """Removal should fail silently if keys are absent.""" mi.remove_ip_addresses(self.inv) mi.remove_ip_addresses(self.inv)