Skip to content

Commit

Permalink
Test case modified
Browse files Browse the repository at this point in the history
  • Loading branch information
lakshmi2506 committed Mar 26, 2024
1 parent 97807bd commit dd2d1b3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
12 changes: 10 additions & 2 deletions cumulusci/oauth/salesforce.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@


def update_login_urls():
"""
Updating to setup the environment variables dynamically
"""
global PROD_LOGIN_URL, SANDBOX_LOGIN_URL
PROD_LOGIN_URL = os.environ.get("SF_PROD_LOGIN_URL") or "https://login.salesforce.com"
SANDBOX_LOGIN_URL = os.environ.get("SF_SANDBOX_LOGIN_URL") or "https://test.salesforce.com"
PROD_LOGIN_URL = (
os.environ.get("SF_PROD_LOGIN_URL") or "https://login.salesforce.com"
)
SANDBOX_LOGIN_URL = (
os.environ.get("SF_SANDBOX_LOGIN_URL") or "https://test.salesforce.com"
)


def jwt_session(
client_id, private_key, username, url=None, auth_url=None, is_sandbox=False
Expand Down
5 changes: 4 additions & 1 deletion cumulusci/oauth/tests/test_salesforce.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from unittest import mock

import pytest
Expand Down Expand Up @@ -28,10 +29,12 @@ def test_jwt_session(encode):
@mock.patch("cumulusci.oauth.salesforce.jwt.encode")
def test_jwt_session__enhanced_domains_enabled(encode):
# raise an assertion error if the registered url was not accessed
os.environ["SF_PROD_LOGIN_URL"] = "https://login.test1.salesforce.com"
os.environ["SF_SANDBOX_LOGIN_URL"] = "https://test.test1.salesforce.com"
with responses.RequestsMock(assert_all_requests_are_fired=True) as rsps:
rsps.add(
responses.POST,
"https://test.salesforce.com/services/oauth2/token",
"https://test.test1.salesforce.com/services/oauth2/token",
body='{"message":"well done mate!"}',
status=200,
)
Expand Down

0 comments on commit dd2d1b3

Please sign in to comment.