diff --git a/tests/app/main/views/test_platform_admin.py b/tests/app/main/views/test_platform_admin.py index 3dd7fe36f..0d7d5fa78 100644 --- a/tests/app/main/views/test_platform_admin.py +++ b/tests/app/main/views/test_platform_admin.py @@ -245,13 +245,13 @@ def test_should_show_archived_services_last( assert response.status_code == 200 mock_get_detailed_services.assert_called_once_with({'detailed': True}) page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') - rows = page.find_all('tbody')[table_index].find_all('tr') - assert len(rows) - assert rows[0] - assert rows[1] - assert rows[0].td.text.strip() == 'A' - assert rows[1].td.text.strip() == 'B' - assert rows[2].td.text.strip() == 'C' + + table_body = page.find_all('table')[table_index].find_all('tbody')[0] + services = [service.tr for service in table_body.find_all('tbody')] + assert len(services) == 3 + assert services[0].td.text.strip() == 'A' + assert services[1].td.text.strip() == 'B' + assert services[2].td.text.strip() == 'C' @pytest.mark.parametrize('research_mode', (True, False)) @@ -274,6 +274,8 @@ def test_shows_archived_label_instead_of_live_or_research_mode_label( assert response.status_code == 200 page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') - flags = page.find_all('tbody')[0].tr.find_all('td')[1] + + table_body = page.find_all('table')[0].find_all('tbody')[0] + service_mode = table_body.find_all('tbody')[0].find_all('tr')[1].td.text.strip() # get second column, which contains flags as text. - assert flags.text.strip() == 'archived' + assert service_mode == 'archived'