-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29294a8
commit f87f1e9
Showing
6 changed files
with
20 additions
and
101 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
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
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 |
---|---|---|
|
@@ -3,12 +3,14 @@ | |
from django.contrib.auth import get_user_model | ||
from django.test import SimpleTestCase | ||
|
||
from unicef_security import pipeline | ||
|
||
from etools.applications.core import auth | ||
from etools.applications.core.tests.cases import BaseTenantTestCase | ||
from etools.applications.users.tests.factories import UserFactory | ||
|
||
SOCIAL_AUTH_PATH = "etools.applications.core.auth.social_auth" | ||
SOCIAL_USER_PATH = "etools.applications.core.auth.social_core_user" | ||
SOCIAL_AUTH_PATH = "unicef_security.pipeline.social_auth" | ||
SOCIAL_USER_PATH = "unicef_security.pipeline.social_core_user" | ||
|
||
|
||
class TestSocialDetails(SimpleTestCase): | ||
|
@@ -27,7 +29,7 @@ def test_details_missing_email(self): | |
'details': self.details | ||
} | ||
with patch(SOCIAL_AUTH_PATH, self.mock_social): | ||
r = auth.social_details( | ||
r = pipeline.social_details( | ||
None, | ||
{}, | ||
{"idp": "123", "email": "[email protected]"} | ||
|
@@ -42,7 +44,7 @@ def test_details(self): | |
'details': self.details | ||
} | ||
with patch(SOCIAL_AUTH_PATH, self.mock_social): | ||
r = auth.social_details( | ||
r = pipeline.social_details( | ||
None, | ||
{}, | ||
{"idp": "123", "email": "[email protected]"} | ||
|
@@ -63,7 +65,7 @@ def setUp(self): | |
|
||
def test_user_exists(self): | ||
self.user = UserFactory(username=self.details["email"]) | ||
r = auth.get_username(None, self.details, None) | ||
r = pipeline.get_username(None, self.details, None) | ||
self.assertEqual(r, {"username": self.details["email"]}) | ||
|
||
|
||
|
@@ -81,7 +83,7 @@ def setUp(self): | |
|
||
def test_no_user(self): | ||
with patch(SOCIAL_USER_PATH, self.mock_social): | ||
r = auth.user_details("strategy", self.details, None, None) | ||
r = pipeline.user_details("strategy", self.details, None, None) | ||
self.assertEqual(r, "Returned") | ||
self.mock_social.user_details.assert_called_with( | ||
"strategy", | ||
|
@@ -97,7 +99,7 @@ def test_no_update(self): | |
) | ||
self.details["business_area_code"] = user.profile.country.business_area_code | ||
with patch(SOCIAL_USER_PATH, self.mock_social): | ||
r = auth.user_details("strategy", self.details, None, user) | ||
r = pipeline.user_details("strategy", self.details, None, user) | ||
self.assertEqual(r, "Returned") | ||
self.mock_social.user_details.assert_called_with( | ||
"strategy", | ||
|
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
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
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