import os import unittest import tempfile import kapitan.cached as cached from kapitan.refs.base import RefController, RefParams, Revealer from kapitan.refs.secrets.gpg import gpg_obj, GPGSecret, GPG_KWARGS, GPG_TARGET_FINGERPRINTS from cryptography.hazmat.primitives import serialization from cryptography.hazmat.backends import default_backend # set GNUPGHOME for test_cli GNUPGHOME = tempfile.mkdtemp() os.environ["GNUPGHOME"] = GNUPGHOME gpg_obj(gnupghome=GNUPGHOME) KEY = cached.gpg_obj.gen_key(cached.gpg_obj.gen_key_input(key_type="RSA", key_length=2048, passphrase="testphrase")) KEY2 = cached.gpg_obj.gen_key(cached.gpg_obj.gen_key_input(key_type="RSA", key_length=2048, passphrase="testphrase")) GPG_TARGET_FINGERPRINTS["KEY"] = KEY.fingerprint GPG_KWARGS["passphrase"] = "testphrase" REFS_HOME = tempfile.mkdtemp() REF_CONTROLLER = RefController(REFS_HOME) REVEALER = Revealer(REF_CONTROLLER)
# limitations under the License. "gpg secrets tests" import os import unittest import tempfile import kapitan.cached as cached from kapitan.refs.base import RefController, RefParams, Revealer from kapitan.refs.secrets.gpg import gpg_obj, GPGSecret, GPG_KWARGS, GPG_TARGET_FINGERPRINTS from cryptography.hazmat.primitives import serialization from cryptography.hazmat.backends import default_backend gpg_obj(gnupghome=tempfile.mkdtemp()) KEY = cached.gpg_obj.gen_key( cached.gpg_obj.gen_key_input(key_type="RSA", key_length=2048, passphrase="testphrase")) KEY2 = cached.gpg_obj.gen_key( cached.gpg_obj.gen_key_input(key_type="RSA", key_length=2048, passphrase="testphrase")) GPG_TARGET_FINGERPRINTS["KEY"] = KEY.fingerprint GPG_KWARGS["passphrase"] = "testphrase" REFS_HOME = tempfile.mkdtemp() REF_CONTROLLER = RefController(REFS_HOME) REVEALER = Revealer(REF_CONTROLLER)