mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-30 11:00:14 -04:00
We have a `client_request` fixture which does a bunch of useful stuff like: - checking the status code of the response - returning a `BeautifulSoup` object For most tests of a platform admin view we used `platform_admin_client` instead. This is not as good because it returns a raw `Response` object and doesn’t do the additional checks. This commit converts all the tests using `platform_admin_client` to: use new `client_request` and log in as `platform_admin_user` before making any requests. This is also nice because it makes any test easy to parametrize with additional users, for example to test differences in behaviour dependant on being platform admin or not.
34 lines
1.6 KiB
Python
34 lines
1.6 KiB
Python
sample_inbound_sms = {'data': [{"id": "activated",
|
|
"number": "0784121212",
|
|
"provider": "provider_one",
|
|
"service": {"id": "123234", "name": "Service One"},
|
|
"active": True,
|
|
"created_at": "2017-08-15T13:30:30.12312",
|
|
"updated_at": "2017-08-15T13:30:30.12312"},
|
|
{"id": "available",
|
|
"number": "0784131313",
|
|
"provider": "provider_one",
|
|
"service": None,
|
|
"active": True,
|
|
"created_at": "2017-08-15T13:30:30.12312",
|
|
"updated_at": None},
|
|
{"id": "deactivated",
|
|
"number": "0784131313",
|
|
"provider": "provider_one",
|
|
"service": None,
|
|
"active": True,
|
|
"created_at": "2017-08-15T13:30:30.12312",
|
|
"updated_at": None}
|
|
]}
|
|
|
|
|
|
def test_inbound_sms_admin(
|
|
client_request,
|
|
platform_admin_user,
|
|
mocker,
|
|
):
|
|
mocker.patch("app.inbound_number_client.get_all_inbound_sms_number_service", return_value=sample_inbound_sms)
|
|
client_request.login(platform_admin_user)
|
|
page = client_request.get("main.inbound_sms_admin")
|
|
assert page.h1.string.strip() == "Inbound SMS"
|