Ejemplo n.º 1
0
    def test_get_attribute_from_tarfile(self):
        with tarfile.open('tests/resources/blade01.tar.gz', 'r:gz') as tf:
            fingerprint=import_conf.get_attribute_from_tarfile('fingerprint',tf)
            name_tar = import_conf.get_attribute_from_tarfile('name', tf)

        self.assertEqual(fingerprint, self.key)
        self.assertEqual(name_tar, self.name)
Ejemplo n.º 2
0
    def test_get_attribute_from_tarfile(self):
        with tarfile.open('tests/resources/blade01.tar.gz', 'r:gz') as tf:
            fingerprint = import_conf.get_attribute_from_tarfile(
                'fingerprint', tf)
            name_tar = import_conf.get_attribute_from_tarfile('name', tf)

        self.assertEqual(fingerprint, self.key)
        self.assertEqual(name_tar, self.name)
Ejemplo n.º 3
0
    def test_import_pgp_with_wrong_key_file_format(self):
        keyring = 'debile.gpg'

        with tarfile.open('tests/resources/blade01.tar.gz', 'r:gz') as tf:
            # Take name instead of the public key
            pub_key = import_conf.get_attribute_from_tarfile('name', tf)

        self.assertRaises(GpgImportException, import_conf.import_pgp,
                          self.user, pub_key, 'public', keyring, self.gpg_home)
Ejemplo n.º 4
0
    def test_import_pgp_with_wrong_key_file_format(self):
        keyring = 'debile.gpg'

        with tarfile.open('tests/resources/blade01.tar.gz', 'r:gz') as tf:
            # Take name instead of the public key
            pub_key = import_conf.get_attribute_from_tarfile('name', tf)

        self.assertRaises(GpgImportException, import_conf.import_pgp, self.user,
            pub_key, 'public', keyring, self.gpg_home)
Ejemplo n.º 5
0
    def test_import_pgp_public_key(self):
        with tarfile.open('tests/resources/blade01.tar.gz', 'r:gz') as tf:
            pub_key = import_conf.get_attribute_from_tarfile('key.pub', tf)

        import_conf.import_pgp(self.user, pub_key, 'public', self.keyring,
                self.gpg_home)

        out,_,_ = run_command(['gpg', '--list-keys', '--keyring', self.keyring])

        self.assertTrue('Debile Autobuilder (Debile Slave Key (blade01))' in out)
Ejemplo n.º 6
0
    def test_import_pgp_secret_key(self):
        with tarfile.open('tests/resources/blade01.tar.gz', 'r:gz') as tf:
            priv_key = import_conf.get_attribute_from_tarfile('key.priv', tf)

        import_conf.import_pgp(self.user, priv_key, 'secret',
                               self.secret_keyring, self.gpg_home)

        out, _, _ = run_command(
            ['gpg', '--list-keys', '--keyring', self.secret_keyring])

        self.assertTrue(
            'Debile Autobuilder (Debile Slave Key (blade01))' in out)