コード例 #1
0
    def _getKeyGenerator(self, ppa_owner_name=None, txn=None):
        """Return a `PPAKeyGenerator` instance.

        Monkey-patch the script object with a fake transaction manager
        and also make it use an alternative (fake and lighter) procedure
        to generate keys for each PPA.
        """
        test_args = []

        if ppa_owner_name is not None:
            test_args.extend(['-p', ppa_owner_name])

        key_generator = PPAKeyGenerator(
            name='ppa-generate-keys', test_args=test_args)

        if txn is None:
            txn = FakeTransaction()
        key_generator.txn = txn

        def fake_key_generation(archive):
            a_key = getUtility(IGPGKeySet).get(1)
            archive.signing_key = a_key

        key_generator.generateKey = fake_key_generation

        return key_generator
コード例 #2
0
    def _getKeyGenerator(self, archive_reference=None, txn=None):
        """Return a `PPAKeyGenerator` instance.

        Monkey-patch the script object with a fake transaction manager
        and also make it use an alternative (fake and lighter) procedure
        to generate keys for each PPA.
        """
        test_args = []

        if archive_reference is not None:
            test_args.extend(['-A', archive_reference])

        key_generator = PPAKeyGenerator(
            name='ppa-generate-keys', test_args=test_args)

        if txn is None:
            txn = FakeTransaction()
        key_generator.txn = txn

        def fake_key_generation(archive):
            a_key = getUtility(IGPGKeySet).getByFingerprint(
                'ABCDEF0123456789ABCDDCBA0000111112345678')
            archive.signing_key_fingerprint = a_key.fingerprint
            archive.signing_key_owner = a_key.owner
            del get_property_cache(archive).signing_key

        key_generator.generateKey = fake_key_generation

        return key_generator
コード例 #3
0
    def _getKeyGenerator(self, ppa_owner_name=None, txn=None):
        """Return a `PPAKeyGenerator` instance.

        Monkey-patch the script object with a fake transaction manager
        and also make it use an alternative (fake and lighter) procedure
        to generate keys for each PPA.
        """
        test_args = []

        if ppa_owner_name is not None:
            test_args.extend(['-p', ppa_owner_name])

        key_generator = PPAKeyGenerator(name='ppa-generate-keys',
                                        test_args=test_args)

        if txn is None:
            txn = FakeTransaction()
        key_generator.txn = txn

        def fake_key_generation(archive):
            a_key = getUtility(IGPGKeySet).get(1)
            archive.signing_key = a_key

        key_generator.generateKey = fake_key_generation

        return key_generator