Пример #1
0
    def test_source_valid(self):

        # write the vault password to the .pwd file
        pwd_path = "/tmp/.pwd"

        # make sure file is not present
        if os.path.exists(pwd_path):
            os.remove(pwd_path)

        # write the pwd to the file
        with open(pwd_path, "w") as text_file:
            text_file.write("open_sesame")

        secrets_vaults = [{
            "type": "keepass",
            "name": "keepass-1",
            "configs": {
                "vault-path": "yac/tests/vaults/vectors/test_vault.kdbx",
                "vault-pwd-path": pwd_path
            }
        }]

        vaults = SecretVaults(secrets_vaults)

        # get the results keepass vault and assert that it is available
        vault = vaults.get_vault('keepass-1')

        self.assertTrue(vault)
Пример #2
0
    def test_json_file_source(self):

        secrets_vaults = [
          {
              "type": "file",
              "name": "file-1",
              "configs": {
                "vault-path": "yac/tests/vault/vectors/file_vault.json"
              }

          }
        ]

        vaults = SecretVaults(secrets_vaults)
        vaults.initialize({})
        # get the results keepass vault and assert that it is available
        vault = vaults.get_vault('file-1')

        self.assertTrue(vault)
Пример #3
0
    def test_source_valid(self):

        secrets_vaults = [
          {
              "type": "s3",
              "name": "s3",
              "configs": {
                "bucket": "gitlab-secure",
                "vault-path": "secrets/s3_vault.json"
              }
             
          }
        ]

        vaults = SecretVaults(secrets_vaults)
        
        # get the resulting s3 vault and assert that it is ready
        vault = vaults.get_vault('s3')

        self.assertTrue(vault.is_ready())