def setUp(self, res): res.return_value.instances.filter.return_value = public_instances() self.manager = EtcdManager() self.manager.instance_id = 'i-deadbeef3' self.manager.region = 'eu-west-1' EtcdCluster.REGIONS = ['eu-west-1', 'eu-central-1'] self.cluster = EtcdCluster(self.manager) self.cluster.load_members() self.assertTrue(EtcdCluster.is_multiregion())
def test_load_members(self, res): res.return_value.instances.filter.return_value = public_instances() self.assertEqual(len(self.cluster.members), 7) with patch('requests.get', Mock(side_effect=Exception)): self.cluster.load_members()