Exemple #1
0
    def test_initTrustFail(self):
        with pytest.raises(Exception):
            Trust("key-not-found")

        with pytest.raises(Exception):
            Trust.getInstance()

        assert Trust.getInstanceOrNone() is None
Exemple #2
0
 def setCheckIfTrusted(self,
                       check_if_trusted: bool,
                       debug_mode: bool = False) -> None:
     self._check_if_trusted = check_if_trusted
     if self._check_if_trusted:
         self._trust_checker = Trust.getInstance()
         # 'Trust.getInstance()' will raise an exception if anything goes wrong (e.g.: 'unable to read public key').
         # Any such exception is explicitly _not_ caught here, as the application should quit with a crash.
         if self._trust_checker:
             self._trust_checker.setFollowSymlinks(debug_mode)
Exemple #3
0
    def setCheckIfTrusted(self, check_if_trusted: bool) -> None:
        self._check_if_trusted = check_if_trusted

        # As part of CURA-7016, for now, we skip checking altogether if the public key is missing. That might not be as
        #   bad as it sounds, as non-admin enterprise users shouldn't have access to that file's location anyway.
        # TODO: DON'T FORGET TO REMOVE THESE (COMMENTS AND) NEXT 2 LINES WHEN WE _CAN_ START SIGNING THE PLUGINS.
        if not os.path.exists(Trust.getPublicRootKeyPath()):
            self._check_if_trusted = False

        if self._check_if_trusted:
            self._trust_checker = Trust.getInstance()
Exemple #4
0
 def setCheckIfTrusted(self, check_if_trusted: bool) -> None:
     self._check_if_trusted = check_if_trusted
     if self._check_if_trusted:
         self._trust_checker = Trust.getInstance()