def test_get_available_azs_with_excludes(self): class_kwargs = { **self.class_kwargs, "az_excludes": {"use1-az6", "use1-az5"} } pg = ParamGen(**class_kwargs) pg._boto_client = MockClient returned_azs = pg.get_available_azs(4) returned_az_list = returned_azs.split(",") test_criteria = [ # tuple (first_param, second_param, test_description) (len(returned_az_list), 4, "Verifying we return 4 AZs"), (len(set(returned_az_list)), 4, "Verifying we return 4 *unique* AZs"), ( ("us-east-1a" not in returned_az_list), True, "Verifying us-east-1a is not returned.", ), ( ("us-east-1b" not in returned_az_list), True, "Verifying us-east-1b is not returned.", ), ] for first_param, second_param, test_desc in test_criteria: with self.subTest(test_desc): self.assertEqual(first_param, second_param)
def test_get_available_azs(self): pg = ParamGen(**self.class_kwargs) pg._boto_client = MockClient returned_azs = pg.get_available_azs(2) returned_az_list = returned_azs.split(",") test_criteria = [ # tuple (first_param, second_param, test_description) (len(returned_az_list), 2, "Verifying we return 2 AZs"), (len(set(returned_az_list)), 2, "Verifying we return 2 *unique* AZs"), ] for first_param, second_param, test_desc in test_criteria: with self.subTest(test_desc): self.assertEqual(first_param, second_param)
def test_genaz_raises_taskcat_exception(self): pg = ParamGen(**self.class_kwargs) pg._boto_client = MockSingleAZClient with self.assertRaises(TaskCatException): pg.get_available_azs(2)