Ejemplo n.º 1
0
 def test_fail_writing_health_check(self, mocked_log, mocked_open):
     """Test that a failure to open the health check file is logged, but otherwise ignored."""
     mocked_open.side_effect = io_error = OSError("Some error")
     record_health()
     mocked_log.assert_called_once_with(
         "Could not write health check time stamp to %s: %s", self.filename,
         io_error)
Ejemplo n.º 2
0
 def test_writing_health_check(self, mocked_datetime, mocked_open):
     """Test that the current time is written to the health check file."""
     mocked_datetime.now.return_value = now = datetime.now()
     record_health()
     mocked_open.assert_called_once_with(self.filename, "w")
     mocked_open().write.assert_called_once_with(now.isoformat())