@@ -181,7 +181,7 @@ def test_invalid_model_attribute_log(self):
181
181
}
182
182
183
183
with self .assertLogs ('djangosaml2' , level = 'DEBUG' ) as logs :
184
- user , _ = self .backend .get_or_create_user (self .backend ._user_lookup_attribute , 'john' , True )
184
+ user , _ = self .backend .get_or_create_user (self .backend ._user_lookup_attribute , 'john' , True , None , None , None , None , None )
185
185
self .backend ._update_user (user , attributes , attribute_mapping )
186
186
187
187
self .assertIn (
@@ -200,11 +200,7 @@ def test_create_user_with_required_fields(self):
200
200
'mail_verified' : [True ],
201
201
}
202
202
# User creation does not fail if several fields are required.
203
- user , created = self .backend .get_or_create_user (
204
- self .backend ._user_lookup_attribute ,
205
-
206
- True
207
- )
203
+ user ,
created = self .
backend .
get_or_create_user (
self .
backend .
_user_lookup_attribute ,
'[email protected] ' ,
True ,
None ,
None ,
None ,
None ,
None )
208
204
209
205
self .
assertEquals (
user .
email ,
'[email protected] ' )
210
206
self .assertIs (user .email_verified , None )
@@ -238,6 +234,7 @@ def test_get_or_create_user_existing(self):
238
234
self .backend ._user_lookup_attribute ,
239
235
'john' ,
240
236
False ,
237
+ None , None , None , None , None
241
238
)
242
239
243
240
self .assertTrue (isinstance (user , TestUser ))
@@ -252,6 +249,7 @@ def test_get_or_create_user_duplicates(self):
252
249
'age' ,
253
250
'' ,
254
251
False ,
252
+ None , None , None , None , None
255
253
)
256
254
257
255
self .assertTrue (user is None )
@@ -268,6 +266,7 @@ def test_get_or_create_user_no_create(self):
268
266
self .backend ._user_lookup_attribute ,
269
267
'paul' ,
270
268
False ,
269
+ None , None , None , None , None
271
270
)
272
271
273
272
self .assertTrue (user is None )
@@ -284,6 +283,7 @@ def test_get_or_create_user_create(self):
284
283
self .backend ._user_lookup_attribute ,
285
284
'paul' ,
286
285
True ,
286
+ None , None , None , None , None
287
287
)
288
288
289
289
self .assertTrue (isinstance (user , TestUser ))
@@ -313,9 +313,6 @@ def clean_user_main_attribute(self, main_attribute):
313
313
''' Replace all spaces an dashes by underscores '''
314
314
return main_attribute .replace ('-' , '_' ).replace (' ' , '_' )
315
315
316
- def get_or_create_user (self , user_lookup_key , user_lookup_value , create_unknown_user , ** kwargs ):
317
- return super ().get_or_create_user (user_lookup_key , user_lookup_value , create_unknown_user , ** kwargs )
318
-
319
316
320
317
class CustomizedSaml2BackendTests (Saml2BackendTests ):
321
318
backend_cls = CustomizedBackend
@@ -367,7 +364,7 @@ def test_authenticate(self):
367
364
368
365
user = self .backend .authenticate (
369
366
None ,
370
- session_info = {'ava' : attributes },
367
+ session_info = {'ava' : attributes , 'issuer' : 'dummy_entity_id' , 'name_id' : 'john' },
371
368
attribute_mapping = attribute_mapping ,
372
369
)
373
370
@@ -402,7 +399,7 @@ def test_update_user_clean_attributes(self):
402
399
backend = LowerCaseSaml2Backend ()
403
400
user = backend .authenticate (
404
401
None ,
405
- session_info = {'ava' : attributes },
402
+ session_info = {'ava' : attributes , 'issuer' : 'dummy_entity_id' , 'name_id' : 'john' },
406
403
attribute_mapping = attribute_mapping ,
407
404
)
408
405
self .assertIsNotNone (user )
0 commit comments