Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rsiera committed Dec 5, 2016
1 parent 4e0e35d commit 3cabb1b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion tests/test_models_host.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
from datetime import datetime
from unittest import TestCase

import mock
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_models_pg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3cabb1b

Please sign in to comment.