refactor tsstats.tests.test_template.test_data
* rename to test_onlinetime * add soup-fixture (renders template + returns BeautifulSoup-instance)
This commit is contained in:
parent
4acfe5bd0b
commit
4ddc6bbf41
|
@ -21,6 +21,12 @@ def output(request):
|
||||||
request.addfinalizer(clean)
|
request.addfinalizer(clean)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def soup(output):
|
||||||
|
render_template(clients, output_path)
|
||||||
|
return BeautifulSoup(open(output_path), 'html.parser')
|
||||||
|
|
||||||
|
|
||||||
def test_debug(output):
|
def test_debug(output):
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
render_template(clients, output_path)
|
render_template(clients, output_path)
|
||||||
|
@ -34,9 +40,6 @@ def test_debug(output):
|
||||||
assert '(' in li.text.split()[1]
|
assert '(' in li.text.split()[1]
|
||||||
|
|
||||||
|
|
||||||
def test_data(output):
|
def test_onlinetime(soup):
|
||||||
render_template(clients, output_path)
|
|
||||||
soup = BeautifulSoup(open(output_path), 'html.parser')
|
|
||||||
# check onlinetime-data
|
|
||||||
assert seconds_to_text(clients['1'].onlinetime) == \
|
assert seconds_to_text(clients['1'].onlinetime) == \
|
||||||
soup.find('span', class_='badge').text
|
soup.find('span', class_='badge').text
|
||||||
|
|
Loading…
Reference in New Issue