def test_bad_url(env_vars, authorizer): bad_server = SecretServer( f"https://{env_vars['tenant']}.secretservercloud.com/nonexistent", authorizer, ) with pytest.raises(SecretServerError): bad_server.get_secret(env_vars["secret_id"])
def test_bad_url(server_json): bad_server = SecretServer( f"https://{server_json['tenant']}.secretservercloud.com/nonexistent", server_json["username"], server_json["password"], ) with pytest.raises(SecretServerError): bad_server.get_secret(1)
def tss_backend(**kwargs): authorizer = PasswordGrantAuthorizer(kwargs['server_url'], kwargs['username'], kwargs['password']) secret_server = SecretServer(kwargs['server_url'], authorizer) secret_dict = secret_server.get_secret(kwargs['secret_id']) secret = ServerSecret(**secret_dict) return secret.fields[kwargs['secret_field']]
from thycotic.secrets.server import SecretServer secret_server = SecretServer("https://secretserverurl/SecretServer", "username", "password", "domain") secret = secret_server.get_secret(1) print(secret)