authentic2-cut/tests/test_api.py

27 lines
750 B
Python

# -*- coding: utf-8 -*-
JOHN = u'Jôhn'
DOE = u'Dôe'
EMAIL = 'john.doe@example.com'
def test_no_email(glc):
app = glc.app
oidc_client = glc.oidc_client
app.authorization = ('Basic', (oidc_client.client_id, oidc_client.client_secret))
response = app.post_json('/api/users/', params={}, status=400)
assert set(response.json['errors']) == set(['first_name', 'last_name', 'email'])
assert response.json['result'] == 0
response = app.post_json('/api/users/', params={
'first_name': JOHN,
'last_name': DOE,
'email': EMAIL,
})
assert response.json['sub']
assert response.json['first_name'] == JOHN
assert response.json['last_name'] == DOE
assert response.json['email'] == EMAIL