Ejemplo n.º 1
0
 def test_get_landscape_log_directory_unprivileged(self):
     """
     If landscape-sysinfo is running as a non-privileged user the
     log directory is stored in their home directory.
     """
     self.assertEqual(get_landscape_log_directory(),
                      os.path.expanduser("~/.landscape"))
Ejemplo n.º 2
0
 def _report_error_note(self, result):
     from landscape.sysinfo.deployment import get_landscape_log_directory
     if self._plugin_error:
         path = os.path.join(get_landscape_log_directory(), "sysinfo.log")
         self.add_note(
             "There were exceptions while processing one or more plugins. "
             "See %s for more information." % path)
     return result
Ejemplo n.º 3
0
 def test_get_landscape_log_directory_privileged(self):
     """
     If landscape-sysinfo is running as a privileged user, then the logs
     should be stored in the system-wide log directory.
     """
     with mock.patch("os.getuid", return_value=0) as uid_mock:
         self.assertEqual(get_landscape_log_directory(),
                          "/var/log/landscape")
         uid_mock.assert_called_once_with()