Skip to content

Commit 4d8e222

Browse files
committed
update_user internal
1 parent 00096f0 commit 4d8e222

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

djangosaml2/backends.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,11 @@ def authenticate(self, request, session_info=None, attribute_mapping=None, creat
176176

177177
# Update user with new attributes from incoming request
178178
if user is not None:
179-
user = self.update_user(user, attributes, attribute_mapping, force_save=created)
179+
user = self._update_user(user, attributes, attribute_mapping, force_save=created)
180180

181181
return user
182182

183-
def update_user(self, user, attributes, attribute_mapping, force_save=False):
183+
def _update_user(self, user, attributes, attribute_mapping, force_save=False):
184184
""" Update a user with a set of attributes and returns the updated user.
185185
186186
By default it uses a mapping defined in the settings constant

tests/testprofiles/tests.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ def test_update_user(self):
5555
'cn': ('John', ),
5656
'sn': ('Doe', ),
5757
}
58-
backend.update_user(user, attributes, attribute_mapping)
58+
backend._update_user(user, attributes, attribute_mapping)
5959
self.assertEqual(user.email, '[email protected]')
6060
self.assertEqual(user.first_name, 'John')
6161
self.assertEqual(user.last_name, 'Doe')
6262

6363
attribute_mapping['saml_age'] = ('age', )
6464
attributes['saml_age'] = ('22', )
65-
backend.update_user(user, attributes, attribute_mapping)
65+
backend._update_user(user, attributes, attribute_mapping)
6666
self.assertEqual(user.age, '22')
6767

6868
def test_update_user_callable_attributes(self):
@@ -81,7 +81,7 @@ def test_update_user_callable_attributes(self):
8181
'cn': ('John', ),
8282
'sn': ('Doe', ),
8383
}
84-
backend.update_user(user, attributes, attribute_mapping)
84+
backend._update_user(user, attributes, attribute_mapping)
8585
self.assertEqual(user.email, '[email protected]')
8686
self.assertEqual(user.first_name, 'John')
8787
self.assertEqual(user.last_name, 'Doe')
@@ -103,7 +103,7 @@ def test_update_user_empty_attribute(self):
103103
'sn': (),
104104
}
105105
with self.assertLogs('djangosaml2', level='DEBUG') as logs:
106-
backend.update_user(user, attributes, attribute_mapping)
106+
backend._update_user(user, attributes, attribute_mapping)
107107
self.assertEqual(user.email, '[email protected]')
108108
self.assertEqual(user.first_name, 'John')
109109
# empty attribute list: no update

0 commit comments

Comments
 (0)