Ejemplo n.º 1
0
    def test_systemd_os_release(self):
        from certbot.util import (get_os_info, get_systemd_os_info,
                                  get_os_info_ua)

        with mock.patch('certbot.compat.os.path.isfile', return_value=True):
            self.assertEqual(get_os_info(
                test_util.vector_path("os-release"))[0], 'systemdos')
            self.assertEqual(get_os_info(
                test_util.vector_path("os-release"))[1], '42')
            self.assertEqual(get_systemd_os_info(os.devnull), ("", ""))
            self.assertEqual(get_os_info_ua(
                test_util.vector_path("os-release")), "SystemdOS")
        with mock.patch('certbot.compat.os.path.isfile', return_value=False):
            self.assertEqual(get_systemd_os_info(), ("", ""))
Ejemplo n.º 2
0
    def test_systemd_os_release(self):
        from certbot.util import (get_os_info, get_systemd_os_info,
                                  get_os_info_ua)

        with mock.patch('os.path.isfile', return_value=True):
            self.assertEqual(get_os_info(
                test_util.vector_path("os-release"))[0], 'systemdos')
            self.assertEqual(get_os_info(
                test_util.vector_path("os-release"))[1], '42')
            self.assertEqual(get_systemd_os_info(os.devnull), ("", ""))
            self.assertEqual(get_os_info_ua(
                test_util.vector_path("os-release")), "SystemdOS")
        with mock.patch('os.path.isfile', return_value=False):
            self.assertEqual(get_systemd_os_info(), ("", ""))
Ejemplo n.º 3
0
 def test_get_systemd_os_info_deprecation(self, _, mock_warn):
     import certbot.util as cbutil
     cbutil.get_systemd_os_info()
     self.assertTrue(mock_warn.called)