Change service billing details

View page that lets you change service billing details and
update details on form submission.
This commit is contained in:
Pea Tyczynska
2021-01-25 15:40:49 +00:00
parent 73031962a7
commit 8f21caa87a
5 changed files with 110 additions and 2 deletions

View File

@@ -5300,3 +5300,54 @@ def test_service_settings_links_to_edit_service_billing_details_page_for_platfor
))
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
assert len(page.find_all('a', attrs={'href': '/services/{}/edit-billing-details'.format(SERVICE_ONE_ID)})) == 1
def test_view_edit_service_billing_details(
platform_admin_client,
service_one,
):
response = platform_admin_client.get(url_for('main.edit_service_billing_details', service_id=SERVICE_ONE_ID))
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
assert page.select_one('h1').text == "Change service billing details"
labels = page.find_all('label', class_="form-label")
labels_list = [
'Billing contact email address', 'Billing contact name', 'Billing reference', 'Purchase order number'
]
for label in labels:
assert label.text.strip() in labels_list
textbox_names = page.find_all('input', class_='govuk-input govuk-!-width-two-thirds')
names_list = ['billing_contact_email_address', 'billing_contact_name', 'billing_reference', 'purchase_order_number']
for name in textbox_names:
assert name.attrs["name"] in names_list
def test_update_service_billing_details(
platform_admin_client,
service_one,
mock_update_service
):
response = platform_admin_client.post(
url_for(
'main.edit_service_billing_details',
service_id=SERVICE_ONE_ID,
),
data={
'billing_contact_email_address': 'accounts@fluff.gov.uk',
'billing_contact_name': 'Flannellette von Fluff',
'billing_reference': '',
'purchase_order_number': 'PO1234'
}
)
assert response.status_code == 302
settings_url = url_for(
'main.service_settings', service_id=SERVICE_ONE_ID, _external=True)
assert response.location == settings_url
mock_update_service.assert_called_with(
SERVICE_ONE_ID,
billing_contact_email_address='accounts@fluff.gov.uk',
billing_contact_name='Flannellette von Fluff',
billing_reference='',
purchase_order_number='PO1234'
)