From 3cabb1b66b086d9c9733787ef0fe2e3da54cff2c Mon Sep 17 00:00:00 2001 From: Radek Sieradzki Date: Mon, 5 Dec 2016 15:01:03 +0100 Subject: [PATCH] Fixed tests --- tests/test_models_host.py | 4 +++- tests/test_models_pg.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/test_models_host.py b/tests/test_models_host.py index ec57a14..88d0e79 100644 --- a/tests/test_models_host.py +++ b/tests/test_models_host.py @@ -1,4 +1,5 @@ import json +from datetime import datetime from unittest import TestCase import mock @@ -31,7 +32,8 @@ def test_refresh_should_call_load_average(self, mocked_getloadavg): @freeze_time('2016-10-31 00:25:00') def test_refresh_should_call_uptime(self, mocked_boot_time): refreshed_data = self.collector._read_uptime() - self.assertEqual({'uptime': '9:50:04'}, refreshed_data) + expected_uptime = datetime(2016, 10, 31, 0, 25) - datetime.fromtimestamp(1477834496.0) + self.assertEqual({'uptime': str(expected_uptime)}, refreshed_data) @mock.patch('pg_view.models.collector_host.socket.gethostname', return_value='Macbook-Pro') def test_refresh_should_call_hostname(self, mocked_gethostname): diff --git a/tests/test_models_pg.py b/tests/test_models_pg.py index 5b14521..26c27db 100644 --- a/tests/test_models_pg.py +++ b/tests/test_models_pg.py @@ -157,8 +157,8 @@ def test__read_proc_should_return_data_when_process_ok(self, mocked_psutil_proce 'vsize': 252428288, 'guest_time': 0.0, - 'starttime': datetime.datetime(2016, 12, 3, 16, 1, 29), - 'delayacct_blkio_ticks': 0, + 'starttime': datetime.datetime.fromtimestamp(1480777289.0), + 'delayacct_blkio_ticks': 0L, 'cmdline': 'backend' } self.assertEqual(expected_proc_stats, proc_stats)