

def testSignedUpdate(self):
    fingerprint = '95B457D16843B21EA3FC73BBC7C32FC1F94E405E'
    keyCache = openpgpkey.getKeyCache()
    keyCache.getPrivateKey(fingerprint, '111111')
    errorIsUncatchable.addQuickTestComponent('test:doc', '1.0-1-1')
    self.cfg.signatureKey = fingerprint
    self.cfg.quiet = True
    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'])
    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'])

    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)
    self.discardOutput(self.assertRaises, MyException, doUpdate, self.cfg, 'test:doc', callback=callback)

dataset/ETHPy150Open sassoftware/conary/conary_test/cvctest/sigtest.py SigTest.testSignedUpdate/VarMisuse@31/71 `self`->`errorIsUncatchable`