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

        callback = checkin.CheckinCallback()
        # make sure there's not a cached repo index 1
        self.stopRepository(1)
        sigRepos = self.openRepository(1, requireSigs = True)
        ascKey = open(resources.get_path('conary_test', 'archive', 'key.asc')).read()
        buildLabel = self.cfg.buildLabel
        signatureKey = self.cfg.signatureKey
        signatureKeyMap = self.cfg.signatureKeyMap
        # try block protects test suite from the alteration of self.cfg
        # or most especially, the effects of leaving a requireSigs repo around
        try:
            self.cfg.signatureKey = None
            self.cfg.signatureKeyMap = None
            self.cfg.buildLabel = versions.Label('localhost1@rpl:linux')
            sigRepos.addNewAsciiPGPKey(self.cfg.buildLabel, 'test', ascKey)
            try:
                self.addQuickTestComponent("test:doc", "/localhost1@rpl:devel/1.0-1-1")
                self.fail("Repository should have required a signature")
            except DigitalSignatureVerificationError:
                pass

            name = 'testcase'
            fullName = name + '=/localhost1@rpl:linux'
            # test commit codepath.
            origDir = os.getcwd()
            try:
                os.chdir(self.workDir)
                self.newpkg(name)
                os.chdir(name)
                self.writeFile(name + '.recipe', testRecipe)
                self.addfile(name + '.recipe')
                try:
                    checkin.commit(sigRepos, self.cfg, 'foobar', callback)
                    self.fail("Repository should have rejected  commit")
                except DigitalSignatureVerificationError:
                    pass
                # but we really need a source trove for the rest of the paths
                self.cfg.signatureKey = fingerprint
                checkin.commit(sigRepos, self.cfg, fullName, None)
                self.cfg.signatureKey = None
            finally:
                os.chdir(origDir)

           # test cook codepath
            try:
                self.cookItem(sigRepos, self.cfg, fullName,
                              callback = callback, ignoreDeps=True)
                self.fail("Repository should have rejected cook")
            except DigitalSignatureVerificationError:
                pass
            self.cfg.signatureKey = fingerprint
            self.cookItem(sigRepos, self.cfg, fullName,
                              callback = callback, ignoreDeps=True)
            self.cfg.signatureKey = None

            # test clone codepath
            try:
                self.clone('/localhost1@rpl:shadow',
                           'testcase:source=/localhost1@rpl:linux')
                self.fail("Repository should have rejected clone")
            except DigitalSignatureVerificationError:
                pass

            # test branch codepath
            try:
                self.mkbranch("1.0-1", "localhost1@rpl:shadow",
                              "testcase:source", shadow = False)
                self.fail("Repository should have rejected branch")
            except DigitalSignatureVerificationError:
                pass

            # test shadow codepath
            try:
                self.mkbranch("1.0-1", "localhost1@rpl:shadow",
                              "testcase:source", shadow = True)
                self.fail("Repository should have rejected shadow")
            except DigitalSignatureVerificationError:
                pass

        finally:
            self.cfg.buildLabel = buildLabel
            self.cfg.signatureKey = signatureKey
            self.cfg.signatureKeyMap = signatureKeyMap
            # this repo MUST be destroyed, other tests will fail against it.
            self.stopRepository(1)
            sigRepos = self.openRepository(1)
        self.addQuickTestComponent("test:doc",
                                   "/localhost1@rpl:devel/1.0-1-1")
dataset/ETHPy150Open sassoftware/conary/conary_test/cvctest/sigtest.py/SigTest.testReposRequireSigs/original