def test_get_load_succeeds(self): mock = flexmock() mock.should_receive('readline').once.and_return( '0.00 0.01 0.05 1/231 11054\n') mock.should_receive('close').once expected = ['0.00', '0.01', '0.05'] self.assertEqual(expected, status.get_load(injected_open=lambda x, y: mock))
def test_get_memory_returns_false_on_ioerror(self): self.assertFalse(status.get_load(injected_open=self._raise_ioerror))
def test_get_load_succeeds(self): mock = flexmock() mock.should_receive('readline').once.and_return('0.00 0.01 0.05 1/231 11054\n') mock.should_receive('close').once expected = ['0.00', '0.01', '0.05'] self.assertEqual(expected, status.get_load(injected_open=lambda x, y: mock))
def test_get_load_returns_false_with_bad_formatting(self): mock = flexmock() mock.should_receive('readline').once.and_return('12345 6789\n') mock.should_receive('close').once self.assertFalse(status.get_load(injected_open=lambda x, y: mock))