fix tests for new platform admin layout

This commit is contained in:
Leo Hemsted
2016-11-14 17:25:07 +00:00
parent d26f7ac441
commit 28adea52ab

View File

@@ -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'