0004-handle-long-attribute-truncate-variations-between-dj.patch
tests/test_default_adapter.py | ||
---|---|---|
196 | 196 | |
197 | 197 | |
198 | 198 |
def test_provision_long_attribute(settings, django_user_model, idp, saml_attributes, caplog): |
199 |
from django import VERSION |
|
200 | ||
199 | 201 |
settings.MELLON_IDENTITY_PROVIDERS = [idp] |
200 | 202 |
settings.MELLON_ATTRIBUTE_MAPPING = { |
201 | 203 |
'email': '{attributes[email][0]}', |
... | ... | |
205 | 207 |
local_saml_attributes = saml_attributes.copy() |
206 | 208 |
local_saml_attributes['first_name'] = [('y' * 32)] |
207 | 209 |
user = SAMLBackend().authenticate(saml_attributes=local_saml_attributes) |
208 |
assert user.first_name == 'y' * 30
|
|
210 |
assert user.first_name in 'y' * 32
|
|
209 | 211 |
assert len(caplog.records) == 4 |
210 | 212 |
assert 'created new user' in caplog.text |
211 | 213 |
assert 'set field first_name' in caplog.text |
212 |
assert 'to value %r ' % ('y' * 30) in caplog.text |
|
214 |
if VERSION[0] <= 2: |
|
215 |
assert 'to value %r ' % ('y' * 30) in caplog.text |
|
216 |
else: |
|
217 |
assert 'to value %r ' % ('y' * 32) in caplog.text |
|
213 | 218 |
assert 'set field last_name' in caplog.text |
214 | 219 |
assert 'set field email' in caplog.text |
215 | 220 | |
216 |
- |