Skip to content

Commit

Permalink
Use dotenv to import worker keys into mitmproxy; add line breaks to d…
Browse files Browse the repository at this point in the history
…ocstrings in mitmproxy test.
  • Loading branch information
Matthew-Grayson committed Mar 16, 2024
1 parent 02bde87 commit 9c0523e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions backend/worker/mitmproxy_sign_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down
6 changes: 4 additions & 2 deletions backend/worker/test_mitmproxy_sign_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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():
Expand Down

0 comments on commit 9c0523e

Please sign in to comment.