def test_that_when_get_identity_pool_roles_and_error_thrown_due_to_invalid_pool_id_the_get_identity_pool_roles_method_returns_error(self):
     '''
     Tests that given an invalid pool id, we properly handle error generated from get_identity_pool_roles
     '''
     self.conn.get_identity_pool_roles.side_effect = ClientError(error_content, 'get_identity_pool_roles')
     # try to delete an unexistent pool id "no_such_pool_id"
     result = boto_cognitoidentity.get_identity_pool_roles(IdentityPoolName='', IdentityPoolId='no_such_pool_id', **conn_parameters)
     mock_calls = self.conn.mock_calls
     self.assertEqual(result.get('error', {}).get('message'), error_message.format('get_identity_pool_roles'))
     self.assertEqual(len(mock_calls), 1)
 def test_that_when_get_identity_pool_roles_with_no_matching_pool_names_the_get_identity_pool_roles_method_returns_none(self):
     '''
     Tests that the given no pool id's matching the given pool name, the results returned is
     None and get_identity_pool_roles should never be called
     '''
     self.conn.list_identity_pools.return_value = identity_pools_ret
     result = boto_cognitoidentity.get_identity_pool_roles(IdentityPoolName="no_such_pool_name", **conn_parameters)
     mock_calls = self.conn.mock_calls
     self.assertIs(result.get('identity_pool_roles', 'key_should_be_there'), None)
     self.assertEqual(len(mock_calls), 1)
     self.assertEqual(result.get('error', 'key_should_not_be_there'), 'key_should_not_be_there')
 def test_that_when_get_identity_pool_roles_with_no_matching_pool_names_the_get_identity_pool_roles_method_returns_none(
     self
 ):
     """
     Tests that the given no pool id's matching the given pool name, the results returned is
     None and get_identity_pool_roles should never be called
     """
     self.conn.list_identity_pools.return_value = identity_pools_ret
     result = boto_cognitoidentity.get_identity_pool_roles(IdentityPoolName="no_such_pool_name", **conn_parameters)
     mock_calls = self.conn.mock_calls
     self.assertIs(result.get("identity_pool_roles", "key_should_be_there"), None)
     self.assertEqual(len(mock_calls), 1)
     self.assertEqual(result.get("error", "key_should_not_be_there"), "key_should_not_be_there")
 def test_that_when_get_identity_pool_roles_with_matching_pool_names_the_get_identity_pool_roles_method_returns_pools_role_properties(self):
     '''
     Tests that the given 2 pool id's matching the given pool name, the results are
     passed through as a list of identity_pool_roles
     '''
     self.conn.list_identity_pools.return_value = identity_pools_ret
     self.conn.get_identity_pool_roles.side_effect = self._get_identity_pool_roles_side_effect
     result = boto_cognitoidentity.get_identity_pool_roles(IdentityPoolName=first_pool_name, **conn_parameters)
     id_pool_roles = result.get('identity_pool_roles')
     self.assertIsNot(id_pool_roles, None)
     self.assertEqual(result.get('error', 'key_should_not_be_there'), 'key_should_not_be_there')
     self.assertEqual(len(id_pool_roles), 2)
     self.assertEqual(id_pool_roles[0], first_pool_role_ret)
     self.assertEqual(id_pool_roles[1], third_pool_role_ret)
 def test_that_when_get_identity_pool_roles_and_error_thrown_due_to_invalid_pool_id_the_get_identity_pool_roles_method_returns_error(
     self
 ):
     """
     Tests that given an invalid pool id, we properly handle error generated from get_identity_pool_roles
     """
     self.conn.get_identity_pool_roles.side_effect = ClientError(error_content, "get_identity_pool_roles")
     # try to delete an unexistent pool id "no_such_pool_id"
     result = boto_cognitoidentity.get_identity_pool_roles(
         IdentityPoolName="", IdentityPoolId="no_such_pool_id", **conn_parameters
     )
     mock_calls = self.conn.mock_calls
     self.assertEqual(result.get("error", {}).get("message"), error_message.format("get_identity_pool_roles"))
     self.assertEqual(len(mock_calls), 1)
def test_that_when_get_identity_pool_roles_with_matching_pool_names_the_get_identity_pool_roles_method_returns_pools_role_properties(boto_conn):
    '''
    Tests that the given 2 pool id's matching the given pool name, the results are
    passed through as a list of identity_pool_roles
    '''
    boto_conn.list_identity_pools.return_value = identity_pools_ret
    boto_conn.get_identity_pool_roles.side_effect = _get_identity_pool_roles_side_effect
    result = boto_cognitoidentity.get_identity_pool_roles(IdentityPoolName=first_pool_name, **pytest.conn_parameters)
    id_pool_roles = result.get('identity_pool_roles')
    assert id_pool_roles is not None
    assert result.get('error', 'key_should_not_be_there') == 'key_should_not_be_there'
    assert len(id_pool_roles) == 2
    assert id_pool_roles[0] == first_pool_role_ret
    assert id_pool_roles[1] == third_pool_role_ret
 def test_that_when_get_identity_pool_roles_with_no_matching_pool_names_the_get_identity_pool_roles_method_returns_none(
     self, ):
     """
     Tests that the given no pool id's matching the given pool name, the results returned is
     None and get_identity_pool_roles should never be called
     """
     self.conn.list_identity_pools.return_value = identity_pools_ret
     result = boto_cognitoidentity.get_identity_pool_roles(
         IdentityPoolName="no_such_pool_name", **conn_parameters)
     mock_calls = self.conn.mock_calls
     assert result.get("identity_pool_roles", "key_should_be_there") is None
     assert len(mock_calls) == 1
     assert result.get(
         "error", "key_should_not_be_there") == "key_should_not_be_there"
 def test_that_when_get_identity_pool_roles_with_matching_pool_names_the_get_identity_pool_roles_method_returns_pools_role_properties(
     self
 ):
     """
     Tests that the given 2 pool id's matching the given pool name, the results are
     passed through as a list of identity_pool_roles
     """
     self.conn.list_identity_pools.return_value = identity_pools_ret
     self.conn.get_identity_pool_roles.side_effect = self._get_identity_pool_roles_side_effect
     result = boto_cognitoidentity.get_identity_pool_roles(IdentityPoolName=first_pool_name, **conn_parameters)
     id_pool_roles = result.get("identity_pool_roles")
     self.assertIsNot(id_pool_roles, None)
     self.assertEqual(result.get("error", "key_should_not_be_there"), "key_should_not_be_there")
     self.assertEqual(len(id_pool_roles), 2)
     self.assertEqual(id_pool_roles[0], first_pool_role_ret)
     self.assertEqual(id_pool_roles[1], third_pool_role_ret)
 def test_that_when_get_identity_pool_roles_and_error_thrown_due_to_invalid_pool_id_the_get_identity_pool_roles_method_returns_error(
     self, ):
     """
     Tests that given an invalid pool id, we properly handle error generated from get_identity_pool_roles
     """
     self.conn.get_identity_pool_roles.side_effect = ClientError(
         error_content, "get_identity_pool_roles")
     # try to delete an unexistent pool id "no_such_pool_id"
     result = boto_cognitoidentity.get_identity_pool_roles(
         IdentityPoolName="",
         IdentityPoolId="no_such_pool_id",
         **conn_parameters)
     mock_calls = self.conn.mock_calls
     assert result.get("error", {}).get("message") == error_message.format(
         "get_identity_pool_roles")
     assert len(mock_calls) == 1
 def test_that_when_get_identity_pool_roles_with_matching_pool_names_the_get_identity_pool_roles_method_returns_pools_role_properties(
     self, ):
     """
     Tests that the given 2 pool id's matching the given pool name, the results are
     passed through as a list of identity_pool_roles
     """
     self.conn.list_identity_pools.return_value = identity_pools_ret
     self.conn.get_identity_pool_roles.side_effect = self._get_identity_pool_roles_side_effect
     result = boto_cognitoidentity.get_identity_pool_roles(
         IdentityPoolName=first_pool_name, **conn_parameters)
     id_pool_roles = result.get("identity_pool_roles")
     assert id_pool_roles is not None
     assert result.get(
         "error", "key_should_not_be_there") == "key_should_not_be_there"
     assert len(id_pool_roles) == 2
     assert id_pool_roles[0] == first_pool_role_ret
     assert id_pool_roles[1] == third_pool_role_ret