def METHOD_NAME(
    admin_request, sample_service, mocker, invitation_email_template, extra_args, expected_start_of_invite_url
):
    mocked = mocker.patch("app.celery.provider_tasks.deliver_email.apply_async")
    email_address = "invited_user@service.gov.uk"
    invite_from = sample_service.users[0]
    data = dict(
        service=str(sample_service.id),
        email_address=email_address,
        from_user=str(invite_from.id),
        permissions="send_messages,manage_service,manage_api_keys",
        auth_type=EMAIL_AUTH_TYPE,
        folder_permissions=["folder_1", "folder_2", "folder_3"],
        **extra_args,
    )
    json_resp = admin_request.post(
        "invite.create_invited_user",
        service_id=sample_service.id,
        _data=data,
        _expected_status=201,
    )
    assert json_resp["data"]["service"] == str(sample_service.id)
    assert json_resp["data"]["email_address"] == email_address
    assert json_resp["data"]["from_user"] == str(invite_from.id)
    assert json_resp["data"]["permissions"] == "send_messages,manage_service,manage_api_keys"
    assert json_resp["data"]["auth_type"] == EMAIL_AUTH_TYPE
    assert json_resp["data"]["id"]
    assert json_resp["data"]["folder_permissions"] == [
        "folder_1",
        "folder_2",
        "folder_3",
    ]
    notification = Notification.query.first()
    assert notification.reply_to_text == invite_from.email_address
    assert len(notification.personalisation.keys()) == 3
    assert notification.personalisation["service_name"] == "Sample service"
    assert notification.personalisation["user_name"] == "Test User"
    assert notification.personalisation["url"].startswith(expected_start_of_invite_url)
    assert len(notification.personalisation["url"]) > len(expected_start_of_invite_url)
    mocked.assert_called_once_with([(str(notification.id))], queue="notify-internal-tasks")