Skip to content

Commit

Permalink
amend
Browse files Browse the repository at this point in the history
  • Loading branch information
domdinicola committed May 31, 2022
1 parent bdb3f2f commit 88be4c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions src/etools/applications/core/tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

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):
Expand All @@ -27,7 +27,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": "test@example.com"}
Expand All @@ -42,7 +42,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": "new@example.com"}
Expand All @@ -63,7 +63,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"]})


Expand All @@ -81,7 +81,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",
Expand All @@ -97,7 +97,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",
Expand All @@ -117,7 +117,7 @@ def test_no_profile_country(self):
user.profile.save()
self.assertIsNone(user.profile.country)
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",
Expand All @@ -140,7 +140,7 @@ def test_is_staff_update(self):
self.details["idp"] = "UNICEF Azure AD"
self.assertFalse(user.is_staff)
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",
Expand Down
2 changes: 1 addition & 1 deletion src/etools/applications/users/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class UserAdminPlus(ExtraUrlMixin, UserAdmin):
@button()
def sync_user(self, request, pk):
user = get_object_or_404(get_user_model(), pk=pk)
sync_user(user.username)
sync_user.delay(user.username)
return HttpResponseRedirect(reverse('admin:users_user_change', args=[user.pk]))

@button()
Expand Down

0 comments on commit 88be4c0

Please sign in to comment.