Stop using platform_admin_client fixture

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.
This commit is contained in:
Chris Hill-Scott
2021-12-30 16:13:49 +00:00
parent 0fd79bb500
commit 50eae6f935
25 changed files with 1021 additions and 816 deletions

View File

@@ -331,7 +331,6 @@ def platform_admin_list_complaints():
return render_template(
'views/platform-admin/complaints.html',
complaints=response['complaints'],
page_title='All Complaints',
page=page,
prev_page=prev_page,
next_page=next_page,

View File

@@ -2,7 +2,7 @@
{% from "components/page-footer.html" import page_footer %}
{% block per_page_title %}
User information for {{ user.name }}
{{ user.name }}
{% endblock %}
{% block platform_admin_content %}

View File

@@ -1,7 +1,7 @@
{% extends "views/platform-admin/_base_template.html" %}
{% block service_page_title %}
Inbound Numbers
{% block per_page_title %}
Inbound SMS
{% endblock %}
{% set table_headings = {

View File

@@ -6,7 +6,7 @@
{% from "components/back-link/macro.njk" import govukBackLink %}
{% block per_page_title %}
{{ '{} letter branding'.format('Update' if is_update else 'Create')}}
{{ '{} letter branding'.format('Update' if is_update else 'Add')}}
{% endblock %}
{% block backLink %}

View File

@@ -4,7 +4,7 @@
{% from "components/table.html" import list_table, field, text_field, link_field, right_aligned_field_heading, hidden_field_heading %}
{% block per_page_title %}
{{ page_title|capitalize }}
Email complaints
{% endblock %}
{% block platform_admin_content %}

View File

@@ -6,7 +6,7 @@
{% from "components/button/macro.njk" import govukButton %}
{% block per_page_title %}
Platform admin
Summary
{% endblock %}
{% block platform_admin_content %}

View File

@@ -1,7 +1,7 @@
{% extends "views/platform-admin/_base_template.html" %}
{% block per_page_title %}
Platform admin
Reports
{% endblock %}
{% block platform_admin_content %}

View File

@@ -5,7 +5,7 @@
{% from "components/back-link/macro.njk" import govukBackLink %}
{% block service_page_title %}
Data retention
Set data retention
{% endblock %}
{% block backLink %}

View File

@@ -5,7 +5,7 @@
{% from "components/back-link/macro.njk" import govukBackLink %}
{% block service_page_title %}
Data retention
Set data retention
{% endblock %}
{% block backLink %}

View File

@@ -5,7 +5,7 @@
{% from "components/back-link/macro.njk" import govukBackLink %}
{% block service_page_title %}
Emails
Free text message allowance
{% endblock %}
{% block backLink %}

View File

@@ -5,7 +5,7 @@
{% from "components/back-link/macro.njk" import govukBackLink %}
{% block service_page_title %}
Set daily message limit
Daily message limit
{% endblock %}
{% block backLink %}

View File

@@ -5,7 +5,7 @@
{% from "components/back-link/macro.njk" import govukBackLink %}
{% block service_page_title %}
Set rate limit
Rate limit
{% endblock %}
{% block backLink %}