0001-tests-add-dummy-connector-to-test-failure-behaviours.patch
tests/settings.py | ||
---|---|---|
31 | 31 |
'passerelle.contrib.teamnet_axel', |
32 | 32 |
'passerelle.contrib.tlmcom', |
33 | 33 |
'passerelle.contrib.tcl', |
34 |
'passerelle.apps.dummy', |
|
34 | 35 |
) |
35 | 36 | |
36 | 37 |
PASSERELLE_APP_FAKE_FAMILY_ENABLED = True |
... | ... | |
45 | 46 | |
46 | 47 |
TCL_URL_TEMPLATE = 'http://tcl.example.net/%s' |
47 | 48 |
TCL_GEOJSON_URL_TEMPLATE = 'http://tcl.example.net/geojson/%s' |
49 | ||
50 |
LOGGING['handlers'].update({ |
|
51 |
'mail_admins': { |
|
52 |
'level': 'ERROR', |
|
53 |
'class': 'django.utils.log.AdminEmailHandler', |
|
54 |
'include_html': True, |
|
55 |
}, |
|
56 |
}) |
|
57 | ||
58 |
LOGGING['loggers']['django.request']['handlers'].append('mail_admins') |
|
59 |
LOGGING['loggers']['passerelle.jsonresponse'] = { |
|
60 |
'handlers': ['mail_admins'], |
|
61 |
'level': 'INFO', |
|
62 |
} |
|
63 |
ADMINS = [ |
|
64 |
('Admin', 'admin@example.net'), |
|
65 |
] |
tests/test_dummy.py | ||
---|---|---|
1 |
# -*- coding: utf-8 -*- |
|
2 | ||
3 |
import pytest |
|
4 | ||
5 |
from django.contrib.contenttypes.models import ContentType |
|
6 | ||
7 |
from passerelle.base.models import ApiUser, AccessRight |
|
8 |
from passerelle.apps.dummy.models import DummyConnector |
|
9 | ||
10 | ||
11 |
@pytest.fixture() |
|
12 |
def dummy(db): |
|
13 |
api = ApiUser.objects.create(username='all', keytype='', key='') |
|
14 | ||
15 |
conn = DummyConnector.objects.create(slug='dummy') |
|
16 |
obj_type = ContentType.objects.get_for_model(conn) |
|
17 |
AccessRight.objects.create(codename='can_access', apiuser=api, |
|
18 |
resource_type=obj_type, |
|
19 |
resource_pk=conn.pk) |
|
20 |
return conn |
|
21 | ||
22 |
@pytest.mark.xfail |
|
23 |
def test_exception_with_utf8(app, dummy, mailoutbox, caplog): |
|
24 |
app.get('/dummy/dummy/exception_with_utf8/', status=500) |
|
25 |
assert u'Exception: é' in mailoutbox[0].body |
|
0 |
- |