Skip to content

Commit be53998

Browse files
authored
Add test for callable saml attribute mapping
1 parent ba00e86 commit be53998

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/testprofiles/tests.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,24 @@ def test_update_user(self):
6868
self.assertEquals(user.get_profile().age, '22')
6969
else:
7070
self.assertEquals(user.age, '22')
71+
72+
def test_update_user_callable_attributes(self):
73+
user = User.objects.create(username='john')
74+
75+
backend = Saml2Backend()
76+
attribute_mapping = {
77+
'uid': ('username', ),
78+
'mail': ('email', ),
79+
'cn': ('process_first_name', ),
80+
'sn': ('last_name', ),
81+
}
82+
attributes = {
83+
'uid': ('john', ),
84+
'mail': ('[email protected]', ),
85+
'cn': ('John', ),
86+
'sn': ('Doe', ),
87+
}
88+
backend.update_user(user, attributes, attribute_mapping)
89+
self.assertEquals(user.email, '[email protected]')
90+
self.assertEquals(user.first_name, 'John')
91+
self.assertEquals(user.last_name, 'Doe')

0 commit comments

Comments
 (0)