From 9c0523e056bf3502c410926080ff865ebd720331 Mon Sep 17 00:00:00 2001 From: "Grayson, Matthew" Date: Fri, 15 Mar 2024 19:00:19 -0500 Subject: [PATCH] Use dotenv to import worker keys into mitmproxy; add line breaks to docstrings in mitmproxy test. --- backend/worker/mitmproxy_sign_requests.py | 3 +++ backend/worker/test_mitmproxy_sign_requests.py | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/worker/mitmproxy_sign_requests.py b/backend/worker/mitmproxy_sign_requests.py index a2c55022..c98ac6e3 100644 --- a/backend/worker/mitmproxy_sign_requests.py +++ b/backend/worker/mitmproxy_sign_requests.py @@ -4,10 +4,13 @@ import traceback # Third-Party Libraries +from dotenv import load_dotenv from mitmproxy import http import requests from requests_http_signature import HTTPSignatureHeaderAuth +load_dotenv() + class SignRequests: """ diff --git a/backend/worker/test_mitmproxy_sign_requests.py b/backend/worker/test_mitmproxy_sign_requests.py index b2b23bc3..95c63498 100644 --- a/backend/worker/test_mitmproxy_sign_requests.py +++ b/backend/worker/test_mitmproxy_sign_requests.py @@ -20,7 +20,8 @@ def test_user_agent_and_signature(): """ This function tests the SignRequests class with a user agent and signature set. - It creates an instance of the SignRequests class with a user agent and signature, makes a request, and verifies the signature. + It creates an instance of the SignRequests class with a user agent and signature, makes a request, and verifies the + signature. """ sr = SignRequests( key_id="crossfeed", @@ -45,7 +46,8 @@ def test_no_user_agent_or_signature_set(): """ This function tests the SignRequests class without a user agent and signature set. - It creates an instance of the SignRequests class without a user agent and signature, makes a request, and checks that no user agent, date, or signature headers are set. + It creates an instance of the SignRequests class without a user agent and signature, makes a request, and checks + that no user agent, date, or signature headers are set. """ sr = SignRequests(key_id="", public_key="", private_key="", user_agent="") with taddons.context():