Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add test for callable saml attribute mapping
  • Loading branch information
joetsoi authored Dec 7, 2016
commit be539986702c0f9cd0af5221308bd749c10be696
21 changes: 21 additions & 0 deletions tests/testprofiles/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,24 @@ def test_update_user(self):
self.assertEquals(user.get_profile().age, '22')
else:
self.assertEquals(user.age, '22')

def test_update_user_callable_attributes(self):
user = User.objects.create(username='john')

backend = Saml2Backend()
attribute_mapping = {
'uid': ('username', ),
'mail': ('email', ),
'cn': ('process_first_name', ),
'sn': ('last_name', ),
}
attributes = {
'uid': ('john', ),
'mail': ('[email protected]', ),
'cn': ('John', ),
'sn': ('Doe', ),
}
backend.update_user(user, attributes, attribute_mapping)
self.assertEquals(user.email, '[email protected]')
self.assertEquals(user.first_name, 'John')
self.assertEquals(user.last_name, 'Doe')