tests: check provisionning without email

This commit is contained in:
Frédéric Péters 2020-07-23 20:03:32 +02:00
parent 19ecf683f2
commit 755590d069
1 changed files with 38 additions and 0 deletions

View File

@ -624,6 +624,44 @@ def test_process_notification_user_provision(pub):
else: # empty value : empty field
assert User.select()[0].form_data['_birthdate'] is None
# check provisionning a count with no email works
for no_email in (None, ''):
User.wipe()
notification = {
'@type': 'provision',
'issuer': 'http://idp.example.net/idp/saml/metadata',
'audience': ['test'],
'objects': {
'@type': 'user',
'data': [
{
'uuid': 'a' * 32,
'first_name': 'John',
'last_name': 'Doé',
'email': no_email,
'zipcode': '13400',
'is_superuser': False,
'roles': [
{
'uuid': '12345',
'name': 'Service petite enfance',
'description': 'etc.',
},
{
'uuid': 'xyz',
'name': 'Service état civil',
'description': 'etc.',
},
],
}
]
}
}
CmdHoboNotify.process_notification(notification)
assert User.count() == 1
assert User.select()[0].first_name == 'John'
assert not User.select()[0].email
def notify_of_exception(exc_info, context):
raise Exception(exc_info)