def test_cancelled_invited_user_accepts_invited_redirect_to_cancelled_invitation(app_,
                                                                                 service_one,
                                                                                 mocker,
                                                                                 mock_get_user,
                                                                                 mock_get_service):
    with app_.test_request_context():
        with app_.test_client() as client:
            cancelled_invitation = create_sample_invite(mocker, service_one, status='cancelled')
            mock_check_token_invite(mocker, cancelled_invitation)
            response = client.get(url_for('main.accept_invite', token='thisisnotarealtoken'))

            app.invite_api_client.check_token.assert_called_with('thisisnotarealtoken')
            assert response.status_code == 200
            page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
            assert page.h1.string.strip() == 'The invitation you were sent has been cancelled'
def test_cancelled_invited_user_accepts_invited_redirect_to_cancelled_invitation(
    client,
    service_one,
    mocker,
    mock_get_user,
    mock_get_service,
):
    cancelled_invitation = create_sample_invite(mocker, service_one, status='cancelled')
    mock_check_token_invite(mocker, cancelled_invitation)
    response = client.get(url_for('main.accept_invite', token='thisisnotarealtoken'))

    app.invite_api_client.check_token.assert_called_with('thisisnotarealtoken')
    assert response.status_code == 200
    page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
    assert page.h1.string.strip() == 'The invitation you were sent has been cancelled'