Skip to content

Commit

Permalink
Add tests, reorg code and bug fixes, and add methods to dynamically f…
Browse files Browse the repository at this point in the history
…ind client_id.
  • Loading branch information
sevignyj committed Nov 28, 2023
1 parent 5216955 commit b68a6b9
Show file tree
Hide file tree
Showing 8 changed files with 657 additions and 206 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ options:
--okta-tile OKTA_TILE
Okta tile URL to use.
--okta-client-id OKTA_CLIENT_ID
Sets the Okta client ID used in OAuth2. If passed, the authorize code flow will run.
For OIE enabled Orgs this sets the Okta client ID to replace the value found by tokendito. It is used in the authorize code flow.
--okta-mfa OKTA_MFA Sets the MFA method
--okta-mfa-response OKTA_MFA_RESPONSE
Sets the MFA response to a challenge
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/test_http_client_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ def test_post_request(client):
assert json_data["json"] == {"key": "value"}


def test_set_cookies(client):
def test_add_cookies(client):
"""Test the ability to set cookies using HTTPClient."""
# Set a test cookie for the client
client.set_cookies({"test_cookie": "cookie_value"})
client.add_cookies({"test_cookie": "cookie_value"})

# Make a request to the /cookies endpoint of httpbin which returns set cookies
response = client.get("https://httpbin.org/cookies")
Expand Down Expand Up @@ -78,7 +78,7 @@ def test_bad_post_request(client, mocker):
def test_reset_session(client):
"""Test the reset method to ensure session is reset."""
# Set a test cookie for the client
client.set_cookies({"test_cookie": "cookie_value"})
client.add_cookies({"test_cookie": "cookie_value"})
# Reset the session
client.reset()

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ def test_init(client):
assert str(expected_user_agent) in str(client.session.headers["User-Agent"])


def test_set_cookies(client):
def test_add_cookies(client):
"""Test setting cookies in the session."""
cookies = {"test_cookie": "cookie_value"}
client.set_cookies(cookies)
client.add_cookies(cookies)
# Check if the provided cookie is set correctly in the session
assert client.session.cookies.get_dict() == cookies

Expand Down Expand Up @@ -188,7 +188,7 @@ def test_get_device_token(client):
"""Test getting device token from the session."""
device_token = "test-device-token"
cookies = {"DT": device_token}
client.set_cookies(cookies)
client.add_cookies(cookies)

# Check if the device token is set correctly in the session
assert client.get_device_token() == device_token
Expand Down
Loading

0 comments on commit b68a6b9

Please sign in to comment.