def test_delete_user_destination(self, find_all_by_destination, remove_func_key_from_templates, dao_delete): user = Mock(User, id=sentinel.user_id) first_func_key = Mock(FuncKey) second_func_key = Mock(FuncKey) find_all_by_destination.return_value = [first_func_key, second_func_key] destination.delete_user_destination(user) find_all_by_destination.assert_called_once_with('user', sentinel.user_id) dao_delete.assert_any_call(first_func_key) dao_delete.assert_any_call(second_func_key) remove_func_key_from_templates.assert_any_call(first_func_key) remove_func_key_from_templates.assert_any_call(second_func_key)
def test_delete_user_destination(self, find_all_by_destination, remove_func_key_from_templates, dao_delete): user = Mock(User, id=sentinel.user_id) first_func_key = Mock(FuncKey) second_func_key = Mock(FuncKey) find_all_by_destination.return_value = [ first_func_key, second_func_key ] destination.delete_user_destination(user) find_all_by_destination.assert_called_once_with( 'user', sentinel.user_id) dao_delete.assert_any_call(first_func_key) dao_delete.assert_any_call(second_func_key) remove_func_key_from_templates.assert_any_call(first_func_key) remove_func_key_from_templates.assert_any_call(second_func_key)
def delete(user): validator.validate_delete(user) func_key_destination.delete_user_destination(user) user_dao.delete(user) template_dao.delete_private_template(user.private_template_id) notifier.deleted(user)