From 4ddc6bbf4179d4b02450842971dfe4f56e425f3e Mon Sep 17 00:00:00 2001 From: Thor77 Date: Fri, 10 Jun 2016 15:36:32 +0200 Subject: [PATCH] refactor tsstats.tests.test_template.test_data * rename to test_onlinetime * add soup-fixture (renders template + returns BeautifulSoup-instance) --- tsstats/tests/test_template.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tsstats/tests/test_template.py b/tsstats/tests/test_template.py index 84710e0..6fcd844 100644 --- a/tsstats/tests/test_template.py +++ b/tsstats/tests/test_template.py @@ -21,6 +21,12 @@ def output(request): request.addfinalizer(clean) +@pytest.fixture +def soup(output): + render_template(clients, output_path) + return BeautifulSoup(open(output_path), 'html.parser') + + def test_debug(output): logger.setLevel(logging.DEBUG) render_template(clients, output_path) @@ -34,9 +40,6 @@ def test_debug(output): assert '(' in li.text.split()[1] -def test_data(output): - render_template(clients, output_path) - soup = BeautifulSoup(open(output_path), 'html.parser') - # check onlinetime-data +def test_onlinetime(soup): assert seconds_to_text(clients['1'].onlinetime) == \ soup.find('span', class_='badge').text