diff --git a/tsstats/tests/res/test.log.stopped b/tsstats/tests/res/test.log.stopped new file mode 100644 index 0000000..339d29c --- /dev/null +++ b/tsstats/tests/res/test.log.stopped @@ -0,0 +1,4 @@ +2015-05-18 15:00:00.000000|INFO |VirtualServer| 1| listening on 0.0.0.0:9987 +2015-05-18 15:30:00.000000|INFO |VirtualServerBase| 3| client connected 'Client1'(id:1) from 1.2.3.4:1234 +2015-05-18 15:40:00.000000|INFO |VirtualServerBase| 3| client connected 'Client2'(id:2) from 5.6.7.8:5678 +2015-05-18 15:50:00.000000|INFO |VirtualServerBase| 1| stopped diff --git a/tsstats/tests/test_log.py b/tsstats/tests/test_log.py index 0bd95ed..17edf02 100644 --- a/tsstats/tests/test_log.py +++ b/tsstats/tests/test_log.py @@ -96,3 +96,9 @@ def test_parse_utf8(): servers = parse_logs(testlog_path + '.utf8') render_servers(servers, output_path) remove(output_path) + + +def test_server_stop(): + clients = _parse_details('tsstats/tests/res/test.log.stopped') + assert clients['1'].onlinetime.seconds / 60 == 20 # minutes + assert clients['2'].onlinetime.seconds / 60 == 10 # minutes