Use render_servers instead of render_template

This commit is contained in:
Thor77 2016-11-23 21:00:35 +01:00
parent 418be10603
commit a3d4cdde5b
1 changed files with 5 additions and 4 deletions

View File

@ -5,12 +5,13 @@ from os import remove
import pytest import pytest
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from tsstats.log import _parse_details from tsstats.log import _parse_details, Server
from tsstats.template import render_template from tsstats.template import render_servers
from tsstats.utils import filter_threshold, seconds_to_text, sort_clients from tsstats.utils import filter_threshold, seconds_to_text, sort_clients
output_path = 'tsstats/tests/res/output.html' output_path = 'tsstats/tests/res/output.html'
clients = _parse_details('tsstats/tests/res/test.log', online_dc=False) clients = _parse_details('tsstats/tests/res/test.log', online_dc=False)
servers = [Server(1, clients)]
logger = logging.getLogger('tsstats') logger = logging.getLogger('tsstats')
@ -24,13 +25,13 @@ def output(request):
@pytest.fixture @pytest.fixture
def soup(output): def soup(output):
render_template(clients, output_path) render_servers(servers, output_path)
return BeautifulSoup(open(output_path), 'html.parser') 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_servers(servers, output_path)
logger.setLevel(logging.INFO) logger.setLevel(logging.INFO)
soup = BeautifulSoup(open(output_path), 'html.parser') soup = BeautifulSoup(open(output_path), 'html.parser')
# check debug-label presence # check debug-label presence