def test_parses_meminfo(self): self.mock_open.return_value.__enter__.return_value.read.return_value = \ '\n'.join(self.meminfo) r = util.get_mem_info() self.assertEqual('10000000 kB', r['MemTotal']) self.assertEqual('4000000 kB', r['MemFree']) self.assertEqual('1000000 kB', r['Buffers']) self.assertEqual('4000000 kB', r['Cached'])
def test_opens_proc_meminfo(self): util.get_mem_info() self.mock_open.assert_called_with('/proc/meminfo')