def test_query_codenames(self): mock_boto_cache = mock.Mock( "taskcat._client_factory.Boto3Cache", autospec=True )() mock_client = mock.Mock() mock_client.describe_images.return_value = {"Images": []} mock_boto_cache.client.return_value = mock_client mock_regional_codename = mock.Mock( "taskcat._amiupdater.RegionalCodename", autospec=True )() mock_regional_codename.region = "us-east-1" mock_regional_codename.cn = "MOCK_CN" mock_regional_codename.filters = [] actual = query_codenames( {mock_regional_codename}, {"us-east-1": mock_boto_cache} ) expected = [{"api_results": [], "cn": "MOCK_CN", "region": "us-east-1"}] self.assertEqual(actual, expected)
def test_query_codenames_raises(self): with self.assertRaises(AMIUpdaterFatalException): query_codenames([], {})