def test_that_when_delete_identity_pools_with_no_matching_pool_names_the_delete_identity_pools_method_returns_false(boto_conn): ''' Tests that the given pool name does not exist, the operation returns deleted status of false and count 0 ''' boto_conn.list_identity_pools.return_value = identity_pools_ret result = boto_cognitoidentity.delete_identity_pools(IdentityPoolName='no_such_pool_name', **pytest.conn_parameters) mock_calls = boto_conn.mock_calls assert result.get('deleted') is False assert result.get('count') == 0 assert len(mock_calls) == 1
def test_that_when_delete_identity_pools_with_no_matching_pool_names_the_delete_identity_pools_method_returns_false(self): ''' Tests that the given pool name does not exist, the operation returns deleted status of false and count 0 ''' self.conn.list_identity_pools.return_value = identity_pools_ret result = boto_cognitoidentity.delete_identity_pools(IdentityPoolName='no_such_pool_name', **conn_parameters) mock_calls = self.conn.mock_calls self.assertIs(result.get('deleted'), False) self.assertEqual(result.get('count'), 0) self.assertEqual(len(mock_calls), 1)
def test_that_when_delete_identity_pools_and_error_thrown_the_delete_identity_pools_method_returns_false_and_the_error(self): ''' Tests that the delete_identity_pool method throws an exception ''' self.conn.delete_identity_pool.side_effect = ClientError(error_content, 'delete_identity_pool') # try to delete an unexistent pool id "no_such_pool_id" result = boto_cognitoidentity.delete_identity_pools(IdentityPoolName=first_pool_name, IdentityPoolId='no_such_pool_id', **conn_parameters) mock_calls = self.conn.mock_calls self.assertIs(result.get('deleted'), False) self.assertIs(result.get('count'), None) self.assertEqual(result.get('error', {}).get('message'), error_message.format('delete_identity_pool')) self.assertEqual(len(mock_calls), 1)
def test_that_when_delete_identity_pools_and_error_thrown_the_delete_identity_pools_method_returns_false_and_the_error(boto_conn): ''' Tests that the delete_identity_pool method throws an exception ''' boto_conn.delete_identity_pool.side_effect = exceptions.ClientError(error_content, 'delete_identity_pool') # try to delete an unexistent pool id "no_such_pool_id" result = boto_cognitoidentity.delete_identity_pools(IdentityPoolName=first_pool_name, IdentityPoolId='no_such_pool_id', **pytest.conn_parameters) mock_calls = boto_conn.mock_calls assert result.get('deleted') is False assert result.get('count') is None assert result.get('error', {}).get('message') == error_message.format('delete_identity_pool') assert len(mock_calls) == 1
def test_that_when_delete_identity_pools_with_no_matching_pool_names_the_delete_identity_pools_method_returns_false( self ): """ Tests that the given pool name does not exist, the operation returns deleted status of false and count 0 """ self.conn.list_identity_pools.return_value = identity_pools_ret result = boto_cognitoidentity.delete_identity_pools(IdentityPoolName="no_such_pool_name", **conn_parameters) mock_calls = self.conn.mock_calls self.assertIs(result.get("deleted"), False) self.assertEqual(result.get("count"), 0) self.assertEqual(len(mock_calls), 1)
def test_that_when_delete_identity_pools_with_no_matching_pool_names_the_delete_identity_pools_method_returns_false( self, ): """ Tests that the given pool name does not exist, the operation returns deleted status of false and count 0 """ self.conn.list_identity_pools.return_value = identity_pools_ret result = boto_cognitoidentity.delete_identity_pools( IdentityPoolName="no_such_pool_name", **conn_parameters) mock_calls = self.conn.mock_calls assert result.get("deleted") is False assert result.get("count") == 0 assert len(mock_calls) == 1
def test_that_when_delete_identity_pools_with_multiple_matching_pool_names_the_delete_identity_pools_methos_returns_true_and_deleted_count(self): ''' Tests that given 2 matching pool ids, the operation returns deleted status of true and count 2 ''' self.conn.list_identity_pools.return_value = identity_pools_ret self.conn.delete_identity_pool.return_value = None result = boto_cognitoidentity.delete_identity_pools(IdentityPoolName=first_pool_name, **conn_parameters) mock_calls = self.conn.mock_calls self.assertTrue(result.get('deleted')) self.assertEqual(result.get('count'), 2) self.assertEqual(len(mock_calls), 3) self.assertEqual(mock_calls[1][0], 'delete_identity_pool') self.assertEqual(mock_calls[2][0], 'delete_identity_pool') self.assertEqual(mock_calls[1][2].get('IdentityPoolId'), first_pool_id) self.assertEqual(mock_calls[2][2].get('IdentityPoolId'), third_pool_id)
def test_that_when_delete_identity_pools_and_error_thrown_the_delete_identity_pools_method_returns_false_and_the_error( self ): """ Tests that the delete_identity_pool method throws an exception """ self.conn.delete_identity_pool.side_effect = ClientError(error_content, "delete_identity_pool") # try to delete an unexistent pool id "no_such_pool_id" result = boto_cognitoidentity.delete_identity_pools( IdentityPoolName=first_pool_name, IdentityPoolId="no_such_pool_id", **conn_parameters ) mock_calls = self.conn.mock_calls self.assertIs(result.get("deleted"), False) self.assertIs(result.get("count"), None) self.assertEqual(result.get("error", {}).get("message"), error_message.format("delete_identity_pool")) self.assertEqual(len(mock_calls), 1)
def test_that_when_delete_identity_pools_with_multiple_matching_pool_names_the_delete_identity_pools_methos_returns_true_and_deleted_count(boto_conn): ''' Tests that given 2 matching pool ids, the operation returns deleted status of true and count 2 ''' boto_conn.list_identity_pools.return_value = identity_pools_ret boto_conn.delete_identity_pool.return_value = None result = boto_cognitoidentity.delete_identity_pools(IdentityPoolName=first_pool_name, **pytest.conn_parameters) mock_calls = boto_conn.mock_calls assert result.get('deleted') is True assert result.get('count') == 2 assert len(mock_calls) == 3 assert mock_calls[1][0] == 'delete_identity_pool' assert mock_calls[2][0] == 'delete_identity_pool' assert mock_calls[1][2].get('IdentityPoolId') == first_pool_id assert mock_calls[2][2].get('IdentityPoolId') == third_pool_id
def test_that_when_delete_identity_pools_with_multiple_matching_pool_names_the_delete_identity_pools_methos_returns_true_and_deleted_count( self ): """ Tests that given 2 matching pool ids, the operation returns deleted status of true and count 2 """ self.conn.list_identity_pools.return_value = identity_pools_ret self.conn.delete_identity_pool.return_value = None result = boto_cognitoidentity.delete_identity_pools(IdentityPoolName=first_pool_name, **conn_parameters) mock_calls = self.conn.mock_calls self.assertTrue(result.get("deleted")) self.assertEqual(result.get("count"), 2) self.assertEqual(len(mock_calls), 3) self.assertEqual(mock_calls[1][0], "delete_identity_pool") self.assertEqual(mock_calls[2][0], "delete_identity_pool") self.assertEqual(mock_calls[1][2].get("IdentityPoolId"), first_pool_id) self.assertEqual(mock_calls[2][2].get("IdentityPoolId"), third_pool_id)
def test_that_when_delete_identity_pools_with_multiple_matching_pool_names_the_delete_identity_pools_methos_returns_true_and_deleted_count( self, ): """ Tests that given 2 matching pool ids, the operation returns deleted status of true and count 2 """ self.conn.list_identity_pools.return_value = identity_pools_ret self.conn.delete_identity_pool.return_value = None result = boto_cognitoidentity.delete_identity_pools( IdentityPoolName=first_pool_name, **conn_parameters) mock_calls = self.conn.mock_calls assert result.get("deleted") assert result.get("count") == 2 assert len(mock_calls) == 3 assert mock_calls[1][0] == "delete_identity_pool" assert mock_calls[2][0] == "delete_identity_pool" assert mock_calls[1][2].get("IdentityPoolId") == first_pool_id assert mock_calls[2][2].get("IdentityPoolId") == third_pool_id
def test_that_when_delete_identity_pools_and_error_thrown_the_delete_identity_pools_method_returns_false_and_the_error( self, ): """ Tests that the delete_identity_pool method throws an exception """ self.conn.delete_identity_pool.side_effect = ClientError( error_content, "delete_identity_pool") # try to delete an unexistent pool id "no_such_pool_id" result = boto_cognitoidentity.delete_identity_pools( IdentityPoolName=first_pool_name, IdentityPoolId="no_such_pool_id", **conn_parameters) mock_calls = self.conn.mock_calls assert result.get("deleted") is False assert result.get("count") is None assert result.get( "error", {}).get("message") == error_message.format("delete_identity_pool") assert len(mock_calls) == 1