diff --git a/tsstats/tests/res/test.log.utf8 b/tsstats/tests/res/test.log.utf8 new file mode 100644 index 0000000..5cef104 --- /dev/null +++ b/tsstats/tests/res/test.log.utf8 @@ -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!' diff --git a/tsstats/tests/test_log.py b/tsstats/tests/test_log.py index 5e10b26..c99e4f1 100644 --- a/tsstats/tests/test_log.py +++ b/tsstats/tests/test_log.py @@ -1,10 +1,13 @@ from datetime import datetime, timedelta +from os import remove from time import sleep import pytest from tsstats.exceptions import InvalidLog 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' @@ -87,3 +90,9 @@ def test_parse_logs(): def test_parse_groups(): clients = _parse_details('tsstats/tests/res/test.log.groups') assert len(clients) == 0 + + +def test_parse_utf8(): + clients = parse_logs(testlog_path + '.utf8')[''] + render_template(clients, output_path) + remove(output_path)