mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-16 19:30:13 -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', [
|
||||
(['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(
|
||||
logged_in_client,
|
||||
@@ -73,8 +79,13 @@ def test_given_option_to_add_letters_if_allowed(
|
||||
assert response.status_code == 200
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
radios = page.select('input[type=radio]')
|
||||
labels = page.select('label')
|
||||
|
||||
assert len(radios) == len(choices)
|
||||
assert len(labels) == len(choices)
|
||||
|
||||
for index, choice in enumerate(choices):
|
||||
assert radios[index].text.strip() == choice
|
||||
for index, choice in enumerate(permissions):
|
||||
assert radios[index]['value'] == choice
|
||||
|
||||
for index, label in enumerate(choices):
|
||||
assert labels[index].text.strip() == label
|
||||
|
||||
Reference in New Issue
Block a user