import pytest


def test_BeautifulSoup_methods_are_overridden(
    client_request,
    mock_get_service_and_organisation_counts,
):
    client_request.logout()
    page = client_request.get("main.index", _test_page_title=False)

    with pytest.raises(AttributeError) as exception:
        page.find("h1")

    assert str(exception.value) == "Don’t use BeautifulSoup.find – try BeautifulSoup.select_one instead"

    with pytest.raises(AttributeError) as exception:
        page.find_all("h1")

    assert str(exception.value) == "Don’t use BeautifulSoup.find_all – try BeautifulSoup.select instead"

Add a test to make sure exception is raised
Add a test to make sure exception is raised

None of our code should be raising this exception, so it’s possible it
could stop working without us knowing about it.

This commit adds a tests to alert us if the override ever does silently
stop working (for example because of a change in `BeautifulSoup`)
