From 3e5c79fc05c9806152088492a6aafefba0ec5a13 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Fri, 10 Jun 2016 16:22:52 +0200 Subject: [PATCH] add test for right identifier in debug-mode --- tsstats/tests/test_template.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tsstats/tests/test_template.py b/tsstats/tests/test_template.py index 6fcd844..ab6999d 100644 --- a/tsstats/tests/test_template.py +++ b/tsstats/tests/test_template.py @@ -32,12 +32,14 @@ def test_debug(output): render_template(clients, output_path) logger.setLevel(logging.INFO) soup = BeautifulSoup(open(output_path), 'html.parser') - # check red label + # check debug-label presence assert soup.find_all(class_='alert alert-danger') - # check ident present after nick - li = soup.find('li') - assert li - assert '(' in li.text.split()[1] + for client_item in soup.find_all('li'): + nick = client_item.find('span').text + # check for right identifier + nick, encl_identifier = nick.split() + identifier = encl_identifier.replace('(', '').replace(')', '') + assert clients[identifier].nick == nick def test_onlinetime(soup):