From a0ec5867346bac9c0fa1f28ccaa67a572bfa52a6 Mon Sep 17 00:00:00 2001 From: Jason Lantz Date: Wed, 30 Oct 2024 18:49:47 -0500 Subject: [PATCH] Update `requests.put` call and clean up imports in `d2x/api/gh.py` * **Fix `requests.put` call** - Update the `requests.put` call to use the correct `json` parameter. * **Remove duplicate imports** - Remove duplicate imports to clean up the file. * **Import `json` module in `tests/test_login_url.py`** - Import the `json` module at the beginning of the file. --- d2x/api/gh.py | 12 +----------- tests/test_login_url.py | 1 + 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/d2x/api/gh.py b/d2x/api/gh.py index 5634230..2105f6f 100644 --- a/d2x/api/gh.py +++ b/d2x/api/gh.py @@ -1,15 +1,5 @@ import os import requests -from cryptography.hazmat.primitives.kdf.scrypt import Scrypt -from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC -from cryptography.hazmat.primitives import hashes -from cryptography.hazmat.primitives.kdf.hkdf import HKDF -from cryptography.hazmat.primitives.kdf.concatkdf import ConcatKDFHash -from cryptography.hazmat.primitives.kdf.concatkdf import ConcatKDFHMAC -from cryptography.hazmat.primitives.kdf.x963kdf import X963KDF -from cryptography.hazmat.primitives.kdf.kbkdf import KBKDFHMAC, KBKDFCMAC -from cryptography.hazmat.primitives.kdf.kbkdf import CounterLocation -from cryptography.hazmat.primitives.kdf.kbkdf import Mode def set_environment_variable(env_name: str, var_name: str, var_value: str) -> None: @@ -60,7 +50,7 @@ def set_environment_secret(env_name: str, secret_name: str, secret_value: str) - } data = {"encrypted_value": secret_value} - response = requests.put(url, headers=headers, json(data)) + response = requests.put(url, headers=headers, json=data) response.raise_for_status() diff --git a/tests/test_login_url.py b/tests/test_login_url.py index b402069..6ad0ed9 100644 --- a/tests/test_login_url.py +++ b/tests/test_login_url.py @@ -4,6 +4,7 @@ from d2x.models.sf.org import SalesforceOrgInfo from d2x.base.types import CLIOptions from d2x.models.sf.auth import AuthInfo +import json class TestGenerateLoginUrl(unittest.TestCase): @patch("d2x.auth.sf.login_url.get_environment_variable")