def test_that_when_update_identity_pool_given_invalid_pool_id_the_update_identity_pool_method_returns_updated_false_and_error(boto_conn):
    '''
    Tests error handling for invalid pool id
    '''
    boto_conn.describe_identity_pool.side_effect = exceptions.ClientError(error_content, 'error on describe identity pool with pool id')
    result = boto_cognitoidentity.update_identity_pool(IdentityPoolId='no_such_pool_id', **pytest.conn_parameters)
    assert result.get('updated') is False
    assert result.get('error', {}).get('message') == error_message.format('error on describe identity pool with pool id')
 def test_that_when_update_identity_pool_given_invalid_pool_id_the_update_identity_pool_method_returns_updated_false_and_error(self):
     '''
     Tests error handling for invalid pool id
     '''
     self.conn.describe_identity_pool.side_effect = ClientError(error_content, 'error on describe identity pool with pool id')
     result = boto_cognitoidentity.update_identity_pool(IdentityPoolId='no_such_pool_id', **conn_parameters)
     self.assertIs(result.get('updated'), False)
     self.assertEqual(result.get('error', {}).get('message'), error_message.format('error on describe identity pool with pool id'))
 def test_that_the_update_identity_pool_method_handles_exception_from_boto3(self):
     '''
     Tests the error handling of exception generated by boto3 update_identity_pool
     '''
     self.conn.describe_identity_pool.return_value = second_pool_ret
     second_pool_updated_ret = second_pool_ret.copy()
     second_pool_updated_ret['DeveloperProviderName'] = 'added_developer_provider'
     self.conn.update_identity_pool.side_effect = ClientError(error_content, 'update_identity_pool')
     result = boto_cognitoidentity.update_identity_pool(IdentityPoolId=second_pool_id, DeveloperProviderName='added_developer_provider', **conn_parameters)
     self.assertIs(result.get('updated'), False)
     self.assertEqual(result.get('error', {}).get('message'), error_message.format('update_identity_pool'))
 def test_that_when_update_identity_pool_given_invalid_pool_id_the_update_identity_pool_method_returns_updated_false_and_error(
     self, ):
     """
     Tests error handling for invalid pool id
     """
     self.conn.describe_identity_pool.side_effect = ClientError(
         error_content, "error on describe identity pool with pool id")
     result = boto_cognitoidentity.update_identity_pool(
         IdentityPoolId="no_such_pool_id", **conn_parameters)
     assert result.get("updated") is False
     assert result.get("error", {}).get("message") == error_message.format(
         "error on describe identity pool with pool id")
 def test_that_when_update_identity_pool_given_only_valid_pool_id_the_update_identity_pool_method_returns_udpated_identity(self):
     '''
     Tests the base case of calling update_identity_pool with only the pool id, verify
     that the passed parameters into boto3 update_identity_pool has at least all the
     expected required parameters in IdentityPoolId, IdentityPoolName and AllowUnauthenticatedIdentities
     '''
     self.conn.describe_identity_pool.return_value = second_pool_ret
     self.conn.update_identity_pool.return_value = second_pool_ret
     expected_params = second_pool_ret
     result = boto_cognitoidentity.update_identity_pool(IdentityPoolId=second_pool_id, **conn_parameters)
     self.assertTrue(result.get('updated'))
     self.assertEqual(result.get('identity_pool'), second_pool_ret)
     self.conn.update_identity_pool.assert_called_with(**expected_params)
 def test_that_when_update_identity_pool_given_valid_pool_id_and_pool_name_the_update_identity_pool_method_returns_updated_identity_pool(self):
     '''
     Tests successful update of a pool's name
     '''
     self.conn.describe_identity_pool.return_value = second_pool_ret
     second_pool_updated_ret = second_pool_ret.copy()
     second_pool_updated_ret['IdentityPoolName'] = second_pool_name_updated
     self.conn.update_identity_pool.return_value = second_pool_updated_ret
     expected_params = second_pool_updated_ret
     result = boto_cognitoidentity.update_identity_pool(IdentityPoolId=second_pool_id, IdentityPoolName=second_pool_name_updated, **conn_parameters)
     self.assertTrue(result.get('updated'))
     self.assertEqual(result.get('identity_pool'), second_pool_updated_ret)
     self.conn.update_identity_pool.assert_called_with(**expected_params)
Exemplo n.º 7
0
 def test_that_the_update_identity_pool_method_handles_exception_from_boto3(self):
     """
     Tests the error handling of exception generated by boto3 update_identity_pool
     """
     self.conn.describe_identity_pool.return_value = second_pool_ret
     second_pool_updated_ret = second_pool_ret.copy()
     second_pool_updated_ret["DeveloperProviderName"] = "added_developer_provider"
     self.conn.update_identity_pool.side_effect = ClientError(error_content, "update_identity_pool")
     result = boto_cognitoidentity.update_identity_pool(
         IdentityPoolId=second_pool_id, DeveloperProviderName="added_developer_provider", **conn_parameters
     )
     self.assertIs(result.get("updated"), False)
     self.assertEqual(result.get("error", {}).get("message"), error_message.format("update_identity_pool"))
Exemplo n.º 8
0
 def test_that_when_update_identity_pool_given_invalid_pool_id_the_update_identity_pool_method_returns_updated_false_and_error(
     self
 ):
     """
     Tests error handling for invalid pool id
     """
     self.conn.describe_identity_pool.side_effect = ClientError(
         error_content, "error on describe identity pool with pool id"
     )
     result = boto_cognitoidentity.update_identity_pool(IdentityPoolId="no_such_pool_id", **conn_parameters)
     self.assertIs(result.get("updated"), False)
     self.assertEqual(
         result.get("error", {}).get("message"), error_message.format("error on describe identity pool with pool id")
     )
 def test_that_when_update_identity_pool_given_developer_provider_name_is_included_in_the_params_when_associated_for_the_first_time(self):
     '''
     Tests the request parameters include 'DeveloperProviderName' when the pool did not have this
     property set previously.
     '''
     self.conn.describe_identity_pool.return_value = second_pool_ret
     second_pool_updated_ret = second_pool_ret.copy()
     second_pool_updated_ret['DeveloperProviderName'] = 'added_developer_provider'
     self.conn.update_identity_pool.return_value = second_pool_updated_ret
     expected_params = second_pool_updated_ret.copy()
     result = boto_cognitoidentity.update_identity_pool(IdentityPoolId=second_pool_id, DeveloperProviderName='added_developer_provider', **conn_parameters)
     self.assertTrue(result.get('updated'))
     self.assertEqual(result.get('identity_pool'), second_pool_updated_ret)
     self.conn.update_identity_pool.assert_called_with(**expected_params)
Exemplo n.º 10
0
 def test_that_when_update_identity_pool_given_developer_provider_name_when_developer_provider_name_was_set_previously_the_udpate_identity_pool_method_is_called_without_developer_provider_name_param(self):
     '''
     Tests the request parameters do not include 'DeveloperProviderName' if this was previously set
     for the given pool id
     '''
     self.conn.describe_identity_pool.return_value = first_pool_ret
     self.conn.update_identity_pool.return_value = first_pool_ret
     expected_params = first_pool_ret.copy()
     expected_params.pop('SupportedLoginProviders')
     expected_params.pop('DeveloperProviderName')
     expected_params.pop('OpenIdConnectProviderARNs')
     result = boto_cognitoidentity.update_identity_pool(IdentityPoolId=first_pool_id, DeveloperProviderName='this should not change', **conn_parameters)
     self.assertTrue(result.get('updated'))
     self.assertEqual(result.get('identity_pool'), first_pool_ret)
     self.conn.update_identity_pool.assert_called_with(**expected_params)
Exemplo n.º 11
0
 def test_that_when_update_identity_pool_given_only_valid_pool_id_the_update_identity_pool_method_returns_udpated_identity(
     self
 ):
     """
     Tests the base case of calling update_identity_pool with only the pool id, verify
     that the passed parameters into boto3 update_identity_pool has at least all the
     expected required parameters in IdentityPoolId, IdentityPoolName and AllowUnauthenticatedIdentities
     """
     self.conn.describe_identity_pool.return_value = second_pool_ret
     self.conn.update_identity_pool.return_value = second_pool_ret
     expected_params = second_pool_ret
     result = boto_cognitoidentity.update_identity_pool(IdentityPoolId=second_pool_id, **conn_parameters)
     self.assertTrue(result.get("updated"))
     self.assertEqual(result.get("identity_pool"), second_pool_ret)
     self.conn.update_identity_pool.assert_called_with(**expected_params)
Exemplo n.º 12
0
 def test_that_when_update_identity_pool_given_empty_list_for_openid_connect_provider_arns_the_update_identity_pool_method_is_called_with_proper_request_params(self):
     '''
     Tests the request parameters to boto3 update_identity_pool's OpenIdConnectProviderARNs is []
     '''
     self.conn.describe_identity_pool.return_value = first_pool_ret
     first_pool_updated_ret = first_pool_ret.copy()
     first_pool_updated_ret.pop('OpenIdConnectProviderARNs')
     self.conn.update_identity_pool.return_value = first_pool_updated_ret
     expected_params = first_pool_ret.copy()
     expected_params.pop('SupportedLoginProviders')
     expected_params.pop('DeveloperProviderName')
     expected_params['OpenIdConnectProviderARNs'] = []
     result = boto_cognitoidentity.update_identity_pool(IdentityPoolId=first_pool_id, OpenIdConnectProviderARNs=[], **conn_parameters)
     self.assertTrue(result.get('updated'))
     self.assertEqual(result.get('identity_pool'), first_pool_updated_ret)
     self.conn.update_identity_pool.assert_called_with(**expected_params)
Exemplo n.º 13
0
 def test_that_when_update_identity_pool_given_empty_dictionary_for_supported_login_providers_the_update_identity_pool_method_is_called_with_proper_request_params(self):
     '''
     Tests the request parameters to boto3 update_identity_pool's AllowUnauthenticatedIdentities is {}
     '''
     self.conn.describe_identity_pool.return_value = first_pool_ret
     first_pool_updated_ret = first_pool_ret.copy()
     first_pool_updated_ret.pop('SupportedLoginProviders')
     self.conn.update_identity_pool.return_value = first_pool_updated_ret
     expected_params = first_pool_ret.copy()
     expected_params['SupportedLoginProviders'] = {}
     expected_params.pop('DeveloperProviderName')
     expected_params.pop('OpenIdConnectProviderARNs')
     result = boto_cognitoidentity.update_identity_pool(IdentityPoolId=first_pool_id, SupportedLoginProviders={}, **conn_parameters)
     self.assertTrue(result.get('updated'))
     self.assertEqual(result.get('identity_pool'), first_pool_updated_ret)
     self.conn.update_identity_pool.assert_called_with(**expected_params)
 def test_that_when_update_identity_pool_given_valid_pool_id_and_pool_name_the_update_identity_pool_method_returns_updated_identity_pool(
     self, ):
     """
     Tests successful update of a pool's name
     """
     self.conn.describe_identity_pool.return_value = second_pool_ret
     second_pool_updated_ret = second_pool_ret.copy()
     second_pool_updated_ret["IdentityPoolName"] = second_pool_name_updated
     self.conn.update_identity_pool.return_value = second_pool_updated_ret
     expected_params = second_pool_updated_ret
     result = boto_cognitoidentity.update_identity_pool(
         IdentityPoolId=second_pool_id,
         IdentityPoolName=second_pool_name_updated,
         **conn_parameters)
     assert result.get("updated")
     assert result.get("identity_pool") == second_pool_updated_ret
     self.conn.update_identity_pool.assert_called_with(**expected_params)
Exemplo n.º 15
0
 def test_that_when_update_identity_pool_given_valid_pool_id_and_pool_name_the_update_identity_pool_method_returns_updated_identity_pool(
     self
 ):
     """
     Tests successful update of a pool's name
     """
     self.conn.describe_identity_pool.return_value = second_pool_ret
     second_pool_updated_ret = second_pool_ret.copy()
     second_pool_updated_ret["IdentityPoolName"] = second_pool_name_updated
     self.conn.update_identity_pool.return_value = second_pool_updated_ret
     expected_params = second_pool_updated_ret
     result = boto_cognitoidentity.update_identity_pool(
         IdentityPoolId=second_pool_id, IdentityPoolName=second_pool_name_updated, **conn_parameters
     )
     self.assertTrue(result.get("updated"))
     self.assertEqual(result.get("identity_pool"), second_pool_updated_ret)
     self.conn.update_identity_pool.assert_called_with(**expected_params)
Exemplo n.º 16
0
 def test_that_when_update_identity_pool_given_developer_provider_name_is_included_in_the_params_when_associated_for_the_first_time(
     self
 ):
     """
     Tests the request parameters include 'DeveloperProviderName' when the pool did not have this
     property set previously.
     """
     self.conn.describe_identity_pool.return_value = second_pool_ret
     second_pool_updated_ret = second_pool_ret.copy()
     second_pool_updated_ret["DeveloperProviderName"] = "added_developer_provider"
     self.conn.update_identity_pool.return_value = second_pool_updated_ret
     expected_params = second_pool_updated_ret.copy()
     result = boto_cognitoidentity.update_identity_pool(
         IdentityPoolId=second_pool_id, DeveloperProviderName="added_developer_provider", **conn_parameters
     )
     self.assertTrue(result.get("updated"))
     self.assertEqual(result.get("identity_pool"), second_pool_updated_ret)
     self.conn.update_identity_pool.assert_called_with(**expected_params)
 def test_that_when_update_identity_pool_given_developer_provider_name_is_included_in_the_params_when_associated_for_the_first_time(
     self, ):
     """
     Tests the request parameters include 'DeveloperProviderName' when the pool did not have this
     property set previously.
     """
     self.conn.describe_identity_pool.return_value = second_pool_ret
     second_pool_updated_ret = second_pool_ret.copy()
     second_pool_updated_ret[
         "DeveloperProviderName"] = "added_developer_provider"
     self.conn.update_identity_pool.return_value = second_pool_updated_ret
     expected_params = second_pool_updated_ret.copy()
     result = boto_cognitoidentity.update_identity_pool(
         IdentityPoolId=second_pool_id,
         DeveloperProviderName="added_developer_provider",
         **conn_parameters)
     assert result.get("updated")
     assert result.get("identity_pool") == second_pool_updated_ret
     self.conn.update_identity_pool.assert_called_with(**expected_params)
Exemplo n.º 18
0
 def test_that_when_update_identity_pool_given_developer_provider_name_when_developer_provider_name_was_set_previously_the_udpate_identity_pool_method_is_called_without_developer_provider_name_param(
     self
 ):
     """
     Tests the request parameters do not include 'DeveloperProviderName' if this was previously set
     for the given pool id
     """
     self.conn.describe_identity_pool.return_value = first_pool_ret
     self.conn.update_identity_pool.return_value = first_pool_ret
     expected_params = first_pool_ret.copy()
     expected_params.pop("SupportedLoginProviders")
     expected_params.pop("DeveloperProviderName")
     expected_params.pop("OpenIdConnectProviderARNs")
     result = boto_cognitoidentity.update_identity_pool(
         IdentityPoolId=first_pool_id, DeveloperProviderName="this should not change", **conn_parameters
     )
     self.assertTrue(result.get("updated"))
     self.assertEqual(result.get("identity_pool"), first_pool_ret)
     self.conn.update_identity_pool.assert_called_with(**expected_params)
 def test_that_the_update_identity_pool_method_handles_exception_from_boto3(
         self):
     """
     Tests the error handling of exception generated by boto3 update_identity_pool
     """
     self.conn.describe_identity_pool.return_value = second_pool_ret
     second_pool_updated_ret = second_pool_ret.copy()
     second_pool_updated_ret[
         "DeveloperProviderName"] = "added_developer_provider"
     self.conn.update_identity_pool.side_effect = ClientError(
         error_content, "update_identity_pool")
     result = boto_cognitoidentity.update_identity_pool(
         IdentityPoolId=second_pool_id,
         DeveloperProviderName="added_developer_provider",
         **conn_parameters)
     assert result.get("updated") is False
     assert result.get(
         "error",
         {}).get("message") == error_message.format("update_identity_pool")
 def test_that_when_update_identity_pool_given_developer_provider_name_when_developer_provider_name_was_set_previously_the_udpate_identity_pool_method_is_called_without_developer_provider_name_param(
     self, ):
     """
     Tests the request parameters do not include 'DeveloperProviderName' if this was previously set
     for the given pool id
     """
     self.conn.describe_identity_pool.return_value = first_pool_ret
     self.conn.update_identity_pool.return_value = first_pool_ret
     expected_params = first_pool_ret.copy()
     expected_params.pop("SupportedLoginProviders")
     expected_params.pop("DeveloperProviderName")
     expected_params.pop("OpenIdConnectProviderARNs")
     result = boto_cognitoidentity.update_identity_pool(
         IdentityPoolId=first_pool_id,
         DeveloperProviderName="this should not change",
         **conn_parameters)
     assert result.get("updated")
     assert result.get("identity_pool") == first_pool_ret
     self.conn.update_identity_pool.assert_called_with(**expected_params)
Exemplo n.º 21
0
 def test_that_when_update_identity_pool_given_empty_list_for_openid_connect_provider_arns_the_update_identity_pool_method_is_called_with_proper_request_params(
     self
 ):
     """
     Tests the request parameters to boto3 update_identity_pool's OpenIdConnectProviderARNs is []
     """
     self.conn.describe_identity_pool.return_value = first_pool_ret
     first_pool_updated_ret = first_pool_ret.copy()
     first_pool_updated_ret.pop("OpenIdConnectProviderARNs")
     self.conn.update_identity_pool.return_value = first_pool_updated_ret
     expected_params = first_pool_ret.copy()
     expected_params.pop("SupportedLoginProviders")
     expected_params.pop("DeveloperProviderName")
     expected_params["OpenIdConnectProviderARNs"] = []
     result = boto_cognitoidentity.update_identity_pool(
         IdentityPoolId=first_pool_id, OpenIdConnectProviderARNs=[], **conn_parameters
     )
     self.assertTrue(result.get("updated"))
     self.assertEqual(result.get("identity_pool"), first_pool_updated_ret)
     self.conn.update_identity_pool.assert_called_with(**expected_params)
Exemplo n.º 22
0
 def test_that_when_update_identity_pool_given_empty_dictionary_for_supported_login_providers_the_update_identity_pool_method_is_called_with_proper_request_params(
     self
 ):
     """
     Tests the request parameters to boto3 update_identity_pool's AllowUnauthenticatedIdentities is {}
     """
     self.conn.describe_identity_pool.return_value = first_pool_ret
     first_pool_updated_ret = first_pool_ret.copy()
     first_pool_updated_ret.pop("SupportedLoginProviders")
     self.conn.update_identity_pool.return_value = first_pool_updated_ret
     expected_params = first_pool_ret.copy()
     expected_params["SupportedLoginProviders"] = {}
     expected_params.pop("DeveloperProviderName")
     expected_params.pop("OpenIdConnectProviderARNs")
     result = boto_cognitoidentity.update_identity_pool(
         IdentityPoolId=first_pool_id, SupportedLoginProviders={}, **conn_parameters
     )
     self.assertTrue(result.get("updated"))
     self.assertEqual(result.get("identity_pool"), first_pool_updated_ret)
     self.conn.update_identity_pool.assert_called_with(**expected_params)
 def test_that_when_update_identity_pool_given_empty_list_for_openid_connect_provider_arns_the_update_identity_pool_method_is_called_with_proper_request_params(
     self, ):
     """
     Tests the request parameters to boto3 update_identity_pool's OpenIdConnectProviderARNs is []
     """
     self.conn.describe_identity_pool.return_value = first_pool_ret
     first_pool_updated_ret = first_pool_ret.copy()
     first_pool_updated_ret.pop("OpenIdConnectProviderARNs")
     self.conn.update_identity_pool.return_value = first_pool_updated_ret
     expected_params = first_pool_ret.copy()
     expected_params.pop("SupportedLoginProviders")
     expected_params.pop("DeveloperProviderName")
     expected_params["OpenIdConnectProviderARNs"] = []
     result = boto_cognitoidentity.update_identity_pool(
         IdentityPoolId=first_pool_id,
         OpenIdConnectProviderARNs=[],
         **conn_parameters)
     assert result.get("updated")
     assert result.get("identity_pool") == first_pool_updated_ret
     self.conn.update_identity_pool.assert_called_with(**expected_params)
 def test_that_when_update_identity_pool_given_empty_dictionary_for_supported_login_providers_the_update_identity_pool_method_is_called_with_proper_request_params(
     self, ):
     """
     Tests the request parameters to boto3 update_identity_pool's AllowUnauthenticatedIdentities is {}
     """
     self.conn.describe_identity_pool.return_value = first_pool_ret
     first_pool_updated_ret = first_pool_ret.copy()
     first_pool_updated_ret.pop("SupportedLoginProviders")
     self.conn.update_identity_pool.return_value = first_pool_updated_ret
     expected_params = first_pool_ret.copy()
     expected_params["SupportedLoginProviders"] = {}
     expected_params.pop("DeveloperProviderName")
     expected_params.pop("OpenIdConnectProviderARNs")
     result = boto_cognitoidentity.update_identity_pool(
         IdentityPoolId=first_pool_id,
         SupportedLoginProviders={},
         **conn_parameters)
     assert result.get("updated")
     assert result.get("identity_pool") == first_pool_updated_ret
     self.conn.update_identity_pool.assert_called_with(**expected_params)