Add testcase for #3 (encoding issues)

This commit is contained in:
Thor77 2016-11-07 20:24:08 +01:00
parent db24696c47
commit 1ec0a37480
2 changed files with 11 additions and 0 deletions

View File

@ -0,0 +1,2 @@
2015-05-18 15:55:23.456679|INFO |VirtualServerBase| 3| client connected 'Cläönt1'(id:1) from 1.2.3.4:1234
2015-05-18 16:00:14.951191|INFO |VirtualServerBase| 3| client disconnected 'Cläönt1'(id:1) reason 'reasonmsg=ByeBye!'

View File

@ -1,10 +1,13 @@
from datetime import datetime, timedelta from datetime import datetime, timedelta
from os import remove
from time import sleep from time import sleep
import pytest import pytest
from tsstats.exceptions import InvalidLog from tsstats.exceptions import InvalidLog
from tsstats.log import TimedLog, _bundle_logs, _parse_details, parse_logs from tsstats.log import TimedLog, _bundle_logs, _parse_details, parse_logs
from tsstats.template import render_template
from tsstats.tests.test_template import output_path
testlog_path = 'tsstats/tests/res/test.log' testlog_path = 'tsstats/tests/res/test.log'
@ -87,3 +90,9 @@ def test_parse_logs():
def test_parse_groups(): def test_parse_groups():
clients = _parse_details('tsstats/tests/res/test.log.groups') clients = _parse_details('tsstats/tests/res/test.log.groups')
assert len(clients) == 0 assert len(clients) == 0
def test_parse_utf8():
clients = parse_logs(testlog_path + '.utf8')['']
render_template(clients, output_path)
remove(output_path)