mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-09 09:29:49 -04:00
Fix test which looks at text of radio buttons
Looks like `radio_button.text` no longer works. Probably a BeautifulSoup change. More robust to look at the text of the label and the value of the input anyway.
This commit is contained in:
@@ -55,8 +55,14 @@ def test_letters_lets_in_without_permission(
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('permissions, choices', [
|
@pytest.mark.parametrize('permissions, choices', [
|
||||||
(['email', 'sms', 'letter'], ['Email', 'Text message', 'Letter']),
|
(
|
||||||
(['email', 'sms'], ['Email', 'Text message'])
|
['email', 'sms', 'letter'],
|
||||||
|
['Email', 'Text message', 'Letter']
|
||||||
|
),
|
||||||
|
(
|
||||||
|
['email', 'sms'],
|
||||||
|
['Email', 'Text message']
|
||||||
|
),
|
||||||
])
|
])
|
||||||
def test_given_option_to_add_letters_if_allowed(
|
def test_given_option_to_add_letters_if_allowed(
|
||||||
logged_in_client,
|
logged_in_client,
|
||||||
@@ -73,8 +79,13 @@ def test_given_option_to_add_letters_if_allowed(
|
|||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||||
radios = page.select('input[type=radio]')
|
radios = page.select('input[type=radio]')
|
||||||
|
labels = page.select('label')
|
||||||
|
|
||||||
assert len(radios) == len(choices)
|
assert len(radios) == len(choices)
|
||||||
|
assert len(labels) == len(choices)
|
||||||
|
|
||||||
for index, choice in enumerate(choices):
|
for index, choice in enumerate(permissions):
|
||||||
assert radios[index].text.strip() == choice
|
assert radios[index]['value'] == choice
|
||||||
|
|
||||||
|
for index, label in enumerate(choices):
|
||||||
|
assert labels[index].text.strip() == label
|
||||||
|
|||||||
Reference in New Issue
Block a user