-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@W-14603959 - code refactoring to fix the test
- Loading branch information
Showing
2 changed files
with
19 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,27 @@ | ||
from ..provider import CustomSalesforceProvider | ||
from allauth.socialaccount.models import SocialApp | ||
import pytest | ||
|
||
@pytest.fixture | ||
def dummy_app(): | ||
app = SocialApp.objects.create( | ||
provider=CustomSalesforceProvider.id, | ||
name=CustomSalesforceProvider.id, | ||
client_id="app123id", | ||
key=CustomSalesforceProvider.id, | ||
secret="dummy", | ||
) | ||
return app | ||
|
||
def test_get_auth_params(rf): | ||
@pytest.mark.django_db | ||
def test_get_auth_params(rf, dummy_app): | ||
request = rf.get("/") | ||
result = CustomSalesforceProvider(request).get_auth_params(request, None) | ||
result = CustomSalesforceProvider(request, dummy_app).get_auth_params(request, None) | ||
assert "prompt" in result and result["prompt"] == "login" | ||
|
||
|
||
def test_extract_uid(rf): | ||
@pytest.mark.django_db | ||
def test_extract_uid(rf, dummy_app): | ||
request = rf.get("/") | ||
provider = CustomSalesforceProvider(request) | ||
provider = CustomSalesforceProvider(request, dummy_app) | ||
result = provider.extract_uid({"organization_id": "ORG", "user_id": "USER"}) | ||
assert result == "ORG/USER" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters