def testSignedUpdate(self):
        fingerprint = '95B457D16843B21EA3FC73BBC7C32FC1F94E405E'
        # supply the pass phrase for our private key
        keyCache = openpgpkey.getKeyCache()
        keyCache.getPrivateKey(fingerprint, '111111')

        self.addQuickTestComponent("test:doc", "1.0-1-1")

        self.cfg.signatureKey = fingerprint
        self.cfg.quiet = True

        # put the public key into the repo
        keyRing = open(resources.get_path('conary_test', 'archive', 'pubring.gpg'))
        keyData = openpgpfile.exportKey(fingerprint, keyRing)
        keyData.seek(0)
        keyData = keyData.read()
        repos = self.openRepository()
        repos.addNewPGPKey(self.cfg.buildLabel, 'test', keyData)
        signtrove.signTroves(self.cfg, [ "test:doc" ])

        # alter key's trust value and determine that the doUpdate
        # code properly verifies trust thresholds
        pubKey = keyCache.getPublicKey(fingerprint)
        pubKey.trustLevel = openpgpfile.TRUST_UNTRUSTED
        keyCache.publicDict[fingerprint] = pubKey
        self.cfg.trustThreshold = openpgpfile.TRUST_ULTIMATE
        self.logFilter.add()
        try:
            self.discardOutput(doUpdate, self.cfg, 'test:doc')
            self.fail("updatecmd.doUpdate did not properly check trust levels")
        except DigitalSignatureVerificationError:
            self.logFilter.compare(['warning: The trove test:doc has '
                'signatures generated with untrusted keys. You can either '
                'resign the trove with a key that you trust, or add one of the '
                'keys to the list of trusted keys (the trustedKeys '
                'configuration option). The keys that were not trusted are: '
                'F94E405E'])

        # An example how one can catch the digital signature verification
        # error for each unsigned trove (and display some message in a GUI
        # maybe). In this case we just raise a different exception.
        class MyException(Exception):
            errorIsUncatchable = True

        class C_(callbacks.UpdateCallback):
            def verifyTroveSignatures(self, trv):
                try:
                    return callbacks.UpdateCallback.verifyTroveSignatures(
                                    self, trv)
                except DigitalSignatureVerificationError:
                    raise MyException("Error in trove %s" * trv.getName())

        callback = C_(trustThreshold=self.cfg.trustThreshold)
        # We should catch our own exception now
        self.discardOutput(self.assertRaises, MyException,
                           doUpdate, self.cfg, "test:doc",
                           callback=callback)
dataset/ETHPy150Open sassoftware/conary/conary_test/cvctest/sigtest.py/SigTest.testSignedUpdate/operator `%` -> `*`