0002-Fixed-failing-tests-under-django-3.2-67945.patch
tests/pricing/manager/test_agenda_pricing.py | ||
---|---|---|
506 | 506 |
adult_external_id='adult:1', |
507 | 507 |
) |
508 | 508 |
] |
509 | ||
510 |
# XXX Compat: html entities are slightly different under django 2 and django 3 |
|
511 |
# the following code ensure tests pass under both versions. |
|
512 |
# The output looks exactly the same to an end user. |
|
509 | 513 |
assert '<p>Pricing: 42.00</p>' in resp |
510 |
assert '<pre>{'foo': 'bar', 'pricing': Decimal('42')}</pre>' in resp |
|
514 |
django2_match = ( |
|
515 |
'<pre>{'foo': 'bar', 'pricing': Decimal('42')}</pre>' in resp |
|
516 |
) |
|
517 |
django3_match = ( |
|
518 |
'<pre>{'foo': 'bar', 'pricing': Decimal('42')}</pre>' in resp |
|
519 |
) |
|
520 |
assert django2_match or django3_match |
|
511 | 521 | |
512 | 522 |
mock_pricing_data.side_effect = PricingError(details={'foo': 'error'}) |
513 | 523 |
resp = resp.form.submit().follow() |
514 | 524 |
assert 'Computed pricing data' in resp |
515 |
assert '<pre>{'error': {'foo': 'error'}}</pre>' in resp |
|
525 |
django2_match = '<pre>{'error': {'foo': 'error'}}</pre>' in resp |
|
526 |
django3_match = '<pre>{'error': {'foo': 'error'}}</pre>' in resp |
|
527 |
assert django2_match or django3_match |
|
516 | 528 | |
517 | 529 | |
518 | 530 |
@mock.patch('lingo.pricing.forms.get_event') |
tests/settings.py | ||
---|---|---|
50 | 50 |
} |
51 | 51 | |
52 | 52 |
PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"] |
53 |
REST_FRAMEWORK = { |
|
54 |
'EXCEPTION_HANDLER': 'lingo.api.utils.exception_handler', |
|
55 |
# this is the default value but by explicitely setting it |
|
56 |
# we avoid a collision with django-webtest erasing the setting |
|
57 |
# while patching it |
|
58 |
'DEFAULT_AUTHENTICATION_CLASSES': [ |
|
59 |
'rest_framework.authentication.SessionAuthentication', |
|
60 |
'rest_framework.authentication.BasicAuthentication', |
|
61 |
], |
|
62 |
} |
|
53 |
- |