Projet

Général

Profil

Bug #18050 » tox-out.log

Christophe Siraut, 12 juin 2018 18:20

 
1
coverage-py27-django18-pylint-pg installed: apipkg==1.4,atomicwrites==1.1.5,attrs==18.1.0,beautifulsoup4==4.6.0,certifi==2018.4.16,chardet==3.0.4,coverage==4.5.1,cssselect==1.0.3,Django==1.8.19,docutils==0.14,execnet==1.5.0,feedparser==5.2.1,funcsigs==1.0.2,gadjo==0.55,html5lib==1.0.1,idna==2.7,lxml==4.2.1,mechanize==0.3.6,mock==2.0.0,more-itertools==4.2.0,pbr==4.0.4,Pillow==5.1.0,pkg-resources==0.0.0,pluggy==0.6.0,psycopg2==2.7.4,py==1.5.3,pyquery==1.4.0,pytest==3.6.1,pytest-cov==2.5.1,pytest-django==3.2.1,pytest-forked==0.2,pytest-mock==1.10.0,pytest-xdist==1.22.2,python-dateutil==2.7.3,python-magic==0.4.15,qrcode==6.0,Quixote==2.7b2,requests==2.19.0,scgi==1.15,six==1.11.0,urllib3==1.23,vobject==0.9.5,waitress==1.1.0,wcs===2.80.5.ga2fab65a,webencodings==0.5.1,WebOb==1.8.2,WebTest==2.0.29,xlwt==1.3.0,XStatic==1.0.1,XStatic-Font-Awesome==4.7.0.0,XStatic-jQuery==1.10.2.1,XStatic-jquery-ui==1.12.0.1,XStatic-OpenSans==1.0.0
2
coverage-py27-django18-pylint-pg runtests: PYTHONHASHSEED='1523384933'
3
coverage-py27-django18-pylint-pg runtests: commands[0] | ./getlasso.sh
4
'/tmp/tox-chris/wcs/coverage-py27-django18-pylint-pg/lib/python2.7/site-packages/lasso.py' -> '/usr/lib/python2.7/dist-packages/lasso.py'
5
'/tmp/tox-chris/wcs/coverage-py27-django18-pylint-pg/lib/python2.7/site-packages/_lasso.x86_64-linux-gnu.so' -> '/usr/lib/python2.7/dist-packages/_lasso.x86_64-linux-gnu.so'
6
coverage-py27-django18-pylint-pg runtests: commands[1] | py.test --junit-xml=test_results.xml --cov=wcs --cov-report xml --cov-config .coveragerc tests
7
============================= test session starts ==============================
8
platform linux2 -- Python 2.7.13, pytest-3.6.1, py-1.5.3, pluggy-0.6.0
9
Django settings: wcs.settings (from environment variable)
10
rootdir: /home/chris/src/wcs, inifile:
11
plugins: xdist-1.22.2, mock-1.10.0, forked-0.2, django-3.2.1, cov-2.5.1
12
collected 1411 items
13

    
14
tests/test_admin_pages.py .............................................. [  3%]
15
.............................................s.......................... [  8%]
16
........................................................................ [ 13%]
17
......................................................FF................ [ 18%]
18
....................s.                                                   [ 20%]
19
tests/test_api.py ...................................................... [ 23%]
20
....................................s.s.......................           [ 28%]
21
tests/test_auth_pages.py ....                                            [ 28%]
22
tests/test_backoffice_pages.py ..........s.s............................ [ 31%]
23
.....................................................................s.s [ 36%]
24
.s.s.s...s.s.....s.s.....s...s.....s.s...........................        [ 41%]
25
tests/test_bounce_processing.py ..                                       [ 41%]
26
tests/test_categories.py .........                                       [ 42%]
27
tests/test_ctl.py .............                                          [ 42%]
28
tests/test_datasource.py .............                                   [ 43%]
29
tests/test_ezt.py ...............                                        [ 44%]
30
tests/test_fc_auth.py ...                                                [ 45%]
31
tests/test_fields.py ......................                              [ 46%]
32
tests/test_form_pages.py ........FF..................................... [ 50%]
33
........................................................................ [ 55%]
34
........................................................................ [ 60%]
35
.........................................FF....................          [ 64%]
36
tests/test_formdata.py ............................................      [ 67%]
37
tests/test_formdef.py ........................                           [ 69%]
38
tests/test_formdef_import.py ........................                    [ 71%]
39
tests/test_hobo.py .......                                               [ 71%]
40
tests/test_hobo_notify.py ..............                                 [ 72%]
41
tests/test_misc.py ....F..........................                       [ 74%]
42
tests/test_prefill.py ........F                                          [ 75%]
43
tests/test_publisher.py ........                                         [ 76%]
44
tests/test_register.py ......................                            [ 77%]
45
tests/test_role.py ....                                                  [ 77%]
46
tests/test_rootdirectory.py ...........                                  [ 78%]
47
tests/test_saml2utils.py .                                               [ 78%]
48
tests/test_saml_auth.py ..............................                   [ 80%]
49
tests/test_sessions.py ........                                          [ 81%]
50
tests/test_sql.py ...................................................... [ 85%]
51
.................s                                                       [ 86%]
52
tests/test_storage.py .......................                            [ 88%]
53
tests/test_strftime.py ..                                                [ 88%]
54
tests/test_templates.py .....                                            [ 88%]
55
tests/test_texts.py ....                                                 [ 89%]
56
tests/test_tracking_code.py ....                                         [ 89%]
57
tests/test_users.py ...                                                  [ 89%]
58
tests/test_variadic_url.py ....................                          [ 90%]
59
tests/test_widgets.py .....................                              [ 92%]
60
tests/test_workflow_import.py ..............................             [ 94%]
61
tests/test_workflows.py ................................................ [ 97%]
62
.......................                                                  [ 99%]
63
tests/test_wscall.py .....                                               [ 99%]
64
tests/test_x509utils.py .                                                [100%]
65

    
66
=================================== FAILURES ===================================
67
_______________________ test_settings_filetypes[pickle] ________________________
68

    
69
pub = <wcs.compat.CompatWcsPublisher object at 0x7fea6023ba90>
70

    
71
    def test_settings_filetypes(pub):
72
        create_superuser(pub)
73
        app = login(get_app(pub))
74
    
75
        resp = app.get('/backoffice/settings/filetypes/')
76
        assert 'There are no file type defined at the moment.' in resp.body
77
        resp.forms[0]['label'] = 'Text files'
78
        resp.forms[0]['mimetypes'] = '.odt'
79
        resp = resp.forms[0].submit('submit')
80
        assert resp.location == 'http://example.net/backoffice/settings/filetypes/'
81
        resp = resp.follow()
82
        assert pub.cfg['filetypes'][1]['label'] == 'Text files'
83
    
84
        resp = resp.click('Text files')
85
        assert resp.forms[0]['mimetypes'].value == 'application/vnd.oasis.opendocument.text'
86
        resp.forms[0]['mimetypes'] = 'application/vnd.oasis.opendocument.text, .doc, .docx, .pdf'
87
        resp = resp.forms[0].submit('submit')
88
        assert resp.location == 'http://example.net/backoffice/settings/filetypes/'
89
        resp = resp.follow()
90
>       assert 'application/msword (.doc)' in resp.body
91
E       assert 'application/msword (.doc)' in '<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset="utf-8"/>\n    <title>Back Office of wcs - File Types</title>\n ...  <div id="footer">\n    w.c.s. \xe2\x80\x94 Copyright \xc2\xa9 Entr\'ouvert\n  </div>\n\n  \n  \n  </body>\n</html>\n'
92
E        +  where '<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset="utf-8"/>\n    <title>Back Office of wcs - File Types</title>\n ...  <div id="footer">\n    w.c.s. \xe2\x80\x94 Copyright \xc2\xa9 Entr\'ouvert\n  </div>\n\n  \n  \n  </body>\n</html>\n' = <200 OK text/html body='<!DOCTYPE...l>\n'/3990>.body
93

    
94
tests/test_admin_pages.py:4071: AssertionError
95
_________________________ test_settings_filetypes[sql] _________________________
96

    
97
pub = <wcs.compat.CompatWcsPublisher object at 0x7fea5fe8ea10>
98

    
99
    def test_settings_filetypes(pub):
100
        create_superuser(pub)
101
        app = login(get_app(pub))
102
    
103
        resp = app.get('/backoffice/settings/filetypes/')
104
        assert 'There are no file type defined at the moment.' in resp.body
105
        resp.forms[0]['label'] = 'Text files'
106
        resp.forms[0]['mimetypes'] = '.odt'
107
        resp = resp.forms[0].submit('submit')
108
        assert resp.location == 'http://example.net/backoffice/settings/filetypes/'
109
        resp = resp.follow()
110
        assert pub.cfg['filetypes'][1]['label'] == 'Text files'
111
    
112
        resp = resp.click('Text files')
113
        assert resp.forms[0]['mimetypes'].value == 'application/vnd.oasis.opendocument.text'
114
        resp.forms[0]['mimetypes'] = 'application/vnd.oasis.opendocument.text, .doc, .docx, .pdf'
115
        resp = resp.forms[0].submit('submit')
116
        assert resp.location == 'http://example.net/backoffice/settings/filetypes/'
117
        resp = resp.follow()
118
>       assert 'application/msword (.doc)' in resp.body
119
E       assert 'application/msword (.doc)' in '<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset="utf-8"/>\n    <title>Back Office of wcs - File Types</title>\n ...  <div id="footer">\n    w.c.s. \xe2\x80\x94 Copyright \xc2\xa9 Entr\'ouvert\n  </div>\n\n  \n  \n  </body>\n</html>\n'
120
E        +  where '<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset="utf-8"/>\n    <title>Back Office of wcs - File Types</title>\n ...  <div id="footer">\n    w.c.s. \xe2\x80\x94 Copyright \xc2\xa9 Entr\'ouvert\n  </div>\n\n  \n  \n  </body>\n</html>\n' = <200 OK text/html body='<!DOCTYPE...l>\n'/3990>.body
121

    
122
tests/test_admin_pages.py:4071: AssertionError
123
__________________________ test_home_keywords[pickle] __________________________
124

    
125
pub = <wcs.compat.CompatWcsPublisher object at 0x7fea5fe42650>
126

    
127
    def test_home_keywords(pub):
128
        formdef = create_formdef()
129
        formdef.category_id = '1'
130
        formdef.keywords = 'hello, world'
131
        formdef.store()
132
        home = get_app(pub).get('/')
133
>       assert '<div data-keywords="hello ' in home.body or '<div data-keywords="world ' in home.body
134
E       assert ('<div data-keywords="hello ' in '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms</title>\n<link rel="stylesheet" type="text/css" href="/static.../li></ul></div><p id="login"><a href="/login">Login</a></p>\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>' or '<div data-keywords="world ' in '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms</title>\n<link rel="stylesheet" type="text/css" href="/static.../li></ul></div><p id="login"><a href="/login">Login</a></p>\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>')
135
E        +  where '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms</title>\n<link rel="stylesheet" type="text/css" href="/static.../li></ul></div><p id="login"><a href="/login">Login</a></p>\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>' = <200 OK text/html body='<!DOCTYPE...tml>'/559>.body
136
E        +  and   '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms</title>\n<link rel="stylesheet" type="text/css" href="/static.../li></ul></div><p id="login"><a href="/login">Login</a></p>\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>' = <200 OK text/html body='<!DOCTYPE...tml>'/559>.body
137

    
138
tests/test_form_pages.py:215: AssertionError
139
___________________________ test_home_keywords[sql] ____________________________
140

    
141
pub = <wcs.compat.CompatWcsPublisher object at 0x7fea5fe82510>
142

    
143
    def test_home_keywords(pub):
144
        formdef = create_formdef()
145
        formdef.category_id = '1'
146
        formdef.keywords = 'hello, world'
147
        formdef.store()
148
        home = get_app(pub).get('/')
149
>       assert '<div data-keywords="hello ' in home.body or '<div data-keywords="world ' in home.body
150
E       assert ('<div data-keywords="hello ' in '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms</title>\n<link rel="stylesheet" type="text/css" href="/static.../li></ul></div><p id="login"><a href="/login">Login</a></p>\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>' or '<div data-keywords="world ' in '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms</title>\n<link rel="stylesheet" type="text/css" href="/static.../li></ul></div><p id="login"><a href="/login">Login</a></p>\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>')
151
E        +  where '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms</title>\n<link rel="stylesheet" type="text/css" href="/static.../li></ul></div><p id="login"><a href="/login">Login</a></p>\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>' = <200 OK text/html body='<!DOCTYPE...tml>'/559>.body
152
E        +  and   '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms</title>\n<link rel="stylesheet" type="text/css" href="/static.../li></ul></div><p id="login"><a href="/login">Login</a></p>\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>' = <200 OK text/html body='<!DOCTYPE...tml>'/559>.body
153

    
154
tests/test_form_pages.py:215: AssertionError
155
_________________ test_item_field_with_disabled_items[pickle] __________________
156

    
157
http_requests = <utilities.HttpRequestsMocking object at 0x7fea5f238e10>
158
pub = <wcs.compat.CompatWcsPublisher object at 0x7fea5f2380d0>
159

    
160
    def test_item_field_with_disabled_items(http_requests, pub):
161
        user = create_user(pub)
162
        formdef = create_formdef()
163
        formdef.data_class().wipe()
164
        ds = {'type': 'json', 'value': 'http://remote.example.net/json'}
165
        formdef.fields = [fields.ItemField(id='0', label='string', type='item',
166
            data_source=ds, display_disabled_items=True)]
167
        formdef.store()
168
    
169
        with mock.patch('qommon.misc.urlopen') as urlopen:
170
            data = {'data': [{'id': '1', 'text': 'hello'}, {'id': '2', 'text': 'world'}]}
171
            urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
172
            resp = get_app(pub).get('/test/')
173
            resp.form['f0'] = '1'
174
            resp.form['f0'] = '2'
175
            resp = resp.form.submit('submit') # -> validation page
176
            resp = resp.form.submit('submit') # -> submit
177
            assert formdef.data_class().select()[0].data['0'] == '2'
178
            assert formdef.data_class().select()[0].data['0_display'] == 'world'
179
    
180
        formdef.data_class().wipe()
181
    
182
        with mock.patch('qommon.misc.urlopen') as urlopen:
183
            data = {'data': [{'id': '1', 'text': 'hello', 'disabled': True}, {'id': '2', 'text': 'world'}]}
184
            urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
185
            resp = get_app(pub).get('/test/')
186
            assert '<option disabled="disabled" value="1">hello</option>' in resp.body
187
            resp.form['f0'] = '1'
188
            resp.form['f0'] = '2'
189
            resp = resp.form.submit('submit') # -> validation page
190
            resp = resp.form.submit('submit') # -> submit
191
            assert formdef.data_class().select()[0].data['0'] == '2'
192
            assert formdef.data_class().select()[0].data['0_display'] == 'world'
193
    
194
            resp = get_app(pub).get('/test/')
195
            assert '<option disabled="disabled" value="1">hello</option>' in resp.body
196
            resp.form['f0'] = '1'
197
            resp = resp.form.submit('submit') # -> validation page
198
            assert 'There were errors processing the form' in resp.body
199
    
200
        formdef.data_class().wipe()
201
        formdef.fields = [fields.ItemField(id='0', label='string', type='item', data_source=ds,
202
            display_disabled_items=False)]
203
        formdef.store()
204
    
205
        with mock.patch('qommon.misc.urlopen') as urlopen:
206
            data = {'data': [{'id': '1', 'text': 'hello', 'disabled': True}, {'id': '2', 'text': 'world'}]}
207
            urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
208
            resp = get_app(pub).get('/test/')
209
            assert not '<option disabled="disabled" value="1">hello</option>' in resp.body
210
            resp.form['f0'] = '2'
211
            resp = resp.form.submit('submit') # -> validation page
212
            resp = resp.form.submit('submit') # -> submit
213
            assert formdef.data_class().select()[0].data['0'] == '2'
214
            assert formdef.data_class().select()[0].data['0_display'] == 'world'
215
    
216
        formdef.data_class().wipe()
217
        formdef.fields = [fields.ItemField(id='0', label='string', type='item',
218
            data_source=ds, show_as_radio=True, display_disabled_items=True)]
219
        formdef.store()
220
    
221
        with mock.patch('qommon.misc.urlopen') as urlopen:
222
            data = {'data': [{'id': '1', 'text': 'hello'}, {'id': '2', 'text': 'world'}]}
223
            urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
224
            resp = get_app(pub).get('/test/')
225
            resp.form['f0'] = '1'
226
            resp.form['f0'] = '2'
227
            resp = resp.form.submit('submit') # -> validation page
228
            resp = resp.form.submit('submit') # -> submit
229
            assert formdef.data_class().select()[0].data['0'] == '2'
230
            assert formdef.data_class().select()[0].data['0_display'] == 'world'
231
    
232
        formdef.data_class().wipe()
233
    
234
        with mock.patch('qommon.misc.urlopen') as urlopen:
235
            data = {'data': [{'id': '1', 'text': 'hello', 'disabled': True}, {'id': '2', 'text': 'world'}]}
236
            urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
237
            resp = get_app(pub).get('/test/')
238
>           assert '<input disabled="disabled" type="radio" name="f0" value="1" />' in resp.body
239
E           assert '<input disabled="disabled" type="radio" name="f0" value="1" />' in '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms - test</title>\n<link rel="stylesheet" type="text/css" href="...utton></div></div>\n</div></form><br class="quixoteform" />\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>'
240
E            +  where '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms - test</title>\n<link rel="stylesheet" type="text/css" href="...utton></div></div>\n</div></form><br class="quixoteform" />\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>' = <200 OK text/html body='<!DOCTYPE...tml>'/1887>.body
241

    
242
tests/test_form_pages.py:4379: AssertionError
243
___________________ test_item_field_with_disabled_items[sql] ___________________
244

    
245
http_requests = <utilities.HttpRequestsMocking object at 0x7fea5ffdc0d0>
246
pub = <wcs.compat.CompatWcsPublisher object at 0x7fea5ffdc4d0>
247

    
248
    def test_item_field_with_disabled_items(http_requests, pub):
249
        user = create_user(pub)
250
        formdef = create_formdef()
251
        formdef.data_class().wipe()
252
        ds = {'type': 'json', 'value': 'http://remote.example.net/json'}
253
        formdef.fields = [fields.ItemField(id='0', label='string', type='item',
254
            data_source=ds, display_disabled_items=True)]
255
        formdef.store()
256
    
257
        with mock.patch('qommon.misc.urlopen') as urlopen:
258
            data = {'data': [{'id': '1', 'text': 'hello'}, {'id': '2', 'text': 'world'}]}
259
            urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
260
            resp = get_app(pub).get('/test/')
261
            resp.form['f0'] = '1'
262
            resp.form['f0'] = '2'
263
            resp = resp.form.submit('submit') # -> validation page
264
            resp = resp.form.submit('submit') # -> submit
265
            assert formdef.data_class().select()[0].data['0'] == '2'
266
            assert formdef.data_class().select()[0].data['0_display'] == 'world'
267
    
268
        formdef.data_class().wipe()
269
    
270
        with mock.patch('qommon.misc.urlopen') as urlopen:
271
            data = {'data': [{'id': '1', 'text': 'hello', 'disabled': True}, {'id': '2', 'text': 'world'}]}
272
            urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
273
            resp = get_app(pub).get('/test/')
274
            assert '<option disabled="disabled" value="1">hello</option>' in resp.body
275
            resp.form['f0'] = '1'
276
            resp.form['f0'] = '2'
277
            resp = resp.form.submit('submit') # -> validation page
278
            resp = resp.form.submit('submit') # -> submit
279
            assert formdef.data_class().select()[0].data['0'] == '2'
280
            assert formdef.data_class().select()[0].data['0_display'] == 'world'
281
    
282
            resp = get_app(pub).get('/test/')
283
            assert '<option disabled="disabled" value="1">hello</option>' in resp.body
284
            resp.form['f0'] = '1'
285
            resp = resp.form.submit('submit') # -> validation page
286
            assert 'There were errors processing the form' in resp.body
287
    
288
        formdef.data_class().wipe()
289
        formdef.fields = [fields.ItemField(id='0', label='string', type='item', data_source=ds,
290
            display_disabled_items=False)]
291
        formdef.store()
292
    
293
        with mock.patch('qommon.misc.urlopen') as urlopen:
294
            data = {'data': [{'id': '1', 'text': 'hello', 'disabled': True}, {'id': '2', 'text': 'world'}]}
295
            urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
296
            resp = get_app(pub).get('/test/')
297
            assert not '<option disabled="disabled" value="1">hello</option>' in resp.body
298
            resp.form['f0'] = '2'
299
            resp = resp.form.submit('submit') # -> validation page
300
            resp = resp.form.submit('submit') # -> submit
301
            assert formdef.data_class().select()[0].data['0'] == '2'
302
            assert formdef.data_class().select()[0].data['0_display'] == 'world'
303
    
304
        formdef.data_class().wipe()
305
        formdef.fields = [fields.ItemField(id='0', label='string', type='item',
306
            data_source=ds, show_as_radio=True, display_disabled_items=True)]
307
        formdef.store()
308
    
309
        with mock.patch('qommon.misc.urlopen') as urlopen:
310
            data = {'data': [{'id': '1', 'text': 'hello'}, {'id': '2', 'text': 'world'}]}
311
            urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
312
            resp = get_app(pub).get('/test/')
313
            resp.form['f0'] = '1'
314
            resp.form['f0'] = '2'
315
            resp = resp.form.submit('submit') # -> validation page
316
            resp = resp.form.submit('submit') # -> submit
317
            assert formdef.data_class().select()[0].data['0'] == '2'
318
            assert formdef.data_class().select()[0].data['0_display'] == 'world'
319
    
320
        formdef.data_class().wipe()
321
    
322
        with mock.patch('qommon.misc.urlopen') as urlopen:
323
            data = {'data': [{'id': '1', 'text': 'hello', 'disabled': True}, {'id': '2', 'text': 'world'}]}
324
            urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
325
            resp = get_app(pub).get('/test/')
326
>           assert '<input disabled="disabled" type="radio" name="f0" value="1" />' in resp.body
327
E           assert '<input disabled="disabled" type="radio" name="f0" value="1" />' in '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms - test</title>\n<link rel="stylesheet" type="text/css" href="...utton></div></div>\n</div></form><br class="quixoteform" />\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>'
328
E            +  where '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms - test</title>\n<link rel="stylesheet" type="text/css" href="...utton></div></div>\n</div></form><br class="quixoteform" />\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>' = <200 OK text/html body='<!DOCTYPE...tml>'/1887>.body
329

    
330
tests/test_form_pages.py:4379: AssertionError
331
____________________________ test_format_mimetypes _____________________________
332

    
333
    def test_format_mimetypes():
334
        assert FileTypesDirectory.format_mimetypes(['application/pdf']) == \
335
                'application/pdf (.pdf)'
336
        assert FileTypesDirectory.format_mimetypes(['application/pdf', 'text/rtf']) == \
337
                'application/pdf (.pdf), text/rtf'
338
>       assert FileTypesDirectory.format_mimetypes(['application/pdf', 'application/msword']) == \
339
                'application/pdf (.pdf), application/msword (.doc)'
340
E       AssertionError: assert 'application/...msword (.dot)' == 'application/p...msword (.doc)'
341
E         Skipping 37 identical leading characters in diff, use -v to show
342
E         - sword (.dot)
343
E         ?           ^
344
E         + sword (.doc)
345
E         ?           ^
346

    
347
tests/test_misc.py:70: AssertionError
348
_______________________ test_prefill_formula_time_value ________________________
349

    
350
    def test_prefill_formula_time_value():
351
        pub.substitutions.get_context_variables = lambda: {}
352
        field = fields.Field()
353
        field.prefill = {'type': 'formula', 'value': 'utils.make_datetime("2018-04-04 10:05").time()'}
354
>       assert field.get_prefill_value() == ('10:05 a.m.', False)
355
E       AssertionError: assert ('10:05', False) == ('10:05 a.m.', False)
356
E         At index 0 diff: '10:05' != '10:05 a.m.'
357
E         Use -v to get the full diff
358

    
359
tests/test_prefill.py:105: AssertionError
360
----------- generated xml file: /home/chris/src/wcs/test_results.xml -----------
361

    
362
---------- coverage: platform linux2, python 2.7.13-final-0 ----------
363
Coverage XML written to file coverage.xml
364

    
365
============= 8 failed, 1383 passed, 20 skipped in 515.52 seconds ==============
366
ERROR: InvocationError: '/tmp/tox-chris/wcs/coverage-py27-django18-pylint-pg/bin/py.test --junit-xml=test_results.xml --cov=wcs --cov-report xml --cov-config .coveragerc tests'
367
coverage-py27-django111-pylint-pg installed: apipkg==1.4,atomicwrites==1.1.5,attrs==18.1.0,beautifulsoup4==4.6.0,certifi==2018.4.16,chardet==3.0.4,coverage==4.5.1,cssselect==1.0.3,Django==1.11.13,docutils==0.14,execnet==1.5.0,feedparser==5.2.1,funcsigs==1.0.2,gadjo==0.55,html5lib==1.0.1,idna==2.7,lxml==4.2.1,mechanize==0.3.6,mock==2.0.0,more-itertools==4.2.0,pbr==4.0.4,Pillow==5.1.0,pkg-resources==0.0.0,pluggy==0.6.0,psycopg2==2.7.4,py==1.5.3,pyquery==1.4.0,pytest==3.6.1,pytest-cov==2.5.1,pytest-django==3.2.1,pytest-forked==0.2,pytest-mock==1.10.0,pytest-xdist==1.22.2,python-dateutil==2.7.3,python-magic==0.4.15,pytz==2018.4,qrcode==6.0,Quixote==2.7b2,requests==2.19.0,scgi==1.15,six==1.11.0,urllib3==1.23,vobject==0.9.5,waitress==1.1.0,wcs===2.80.5.ga2fab65a,webencodings==0.5.1,WebOb==1.8.2,WebTest==2.0.29,xlwt==1.3.0,XStatic==1.0.1,XStatic-Font-Awesome==4.7.0.0,XStatic-jQuery==1.10.2.1,XStatic-jquery-ui==1.12.0.1,XStatic-OpenSans==1.0.0
368
coverage-py27-django111-pylint-pg runtests: PYTHONHASHSEED='1523384933'
369
coverage-py27-django111-pylint-pg runtests: commands[0] | ./getlasso.sh
370
'/tmp/tox-chris/wcs/coverage-py27-django111-pylint-pg/lib/python2.7/site-packages/lasso.py' -> '/usr/lib/python2.7/dist-packages/lasso.py'
371
'/tmp/tox-chris/wcs/coverage-py27-django111-pylint-pg/lib/python2.7/site-packages/_lasso.x86_64-linux-gnu.so' -> '/usr/lib/python2.7/dist-packages/_lasso.x86_64-linux-gnu.so'
372
coverage-py27-django111-pylint-pg runtests: commands[1] | py.test --junit-xml=test_results.xml --cov=wcs --cov-report xml --cov-config .coveragerc tests
373
============================= test session starts ==============================
374
platform linux2 -- Python 2.7.13, pytest-3.6.1, py-1.5.3, pluggy-0.6.0
375
Django settings: wcs.settings (from environment variable)
376
rootdir: /home/chris/src/wcs, inifile:
377
plugins: xdist-1.22.2, mock-1.10.0, forked-0.2, django-3.2.1, cov-2.5.1
378
collected 1411 items
379

    
380
tests/test_admin_pages.py .............................................. [  3%]
381
.............................................s.......................... [  8%]
382
........................................................................ [ 13%]
383
......................................................FF................ [ 18%]
384
....................s.                                                   [ 20%]
385
tests/test_api.py ...................................................... [ 23%]
386
....................................s.s.......................           [ 28%]
387
tests/test_auth_pages.py ....                                            [ 28%]
388
tests/test_backoffice_pages.py ..........s.s............................ [ 31%]
389
.....................................................................s.s [ 36%]
390
.s.s.s...s.s.....s.s.....s...s.....s.s...........................        [ 41%]
391
tests/test_bounce_processing.py ..                                       [ 41%]
392
tests/test_categories.py .........                                       [ 42%]
393
tests/test_ctl.py .............                                          [ 42%]
394
tests/test_datasource.py .............                                   [ 43%]
395
tests/test_ezt.py ...............                                        [ 44%]
396
tests/test_fc_auth.py ...                                                [ 45%]
397
tests/test_fields.py ......................                              [ 46%]
398
tests/test_form_pages.py ........FF..................................... [ 50%]
399
........................................................................ [ 55%]
400
........................................................................ [ 60%]
401
.........................................FF....................          [ 64%]
402
tests/test_formdata.py ............................................      [ 67%]
403
tests/test_formdef.py ........................                           [ 69%]
404
tests/test_formdef_import.py ........................                    [ 71%]
405
tests/test_hobo.py .......                                               [ 71%]
406
tests/test_hobo_notify.py ..............                                 [ 72%]
407
tests/test_misc.py ....F..........................                       [ 74%]
408
tests/test_prefill.py ........F                                          [ 75%]
409
tests/test_publisher.py ........                                         [ 76%]
410
tests/test_register.py ......................                            [ 77%]
411
tests/test_role.py ....                                                  [ 77%]
412
tests/test_rootdirectory.py ...........                                  [ 78%]
413
tests/test_saml2utils.py .                                               [ 78%]
414
tests/test_saml_auth.py ..............................                   [ 80%]
415
tests/test_sessions.py ........                                          [ 81%]
416
tests/test_sql.py ...................................................... [ 85%]
417
.................s                                                       [ 86%]
418
tests/test_storage.py .......................                            [ 88%]
419
tests/test_strftime.py ..                                                [ 88%]
420
tests/test_templates.py .....                                            [ 88%]
421
tests/test_texts.py ....                                                 [ 89%]
422
tests/test_tracking_code.py ....                                         [ 89%]
423
tests/test_users.py ...                                                  [ 89%]
424
tests/test_variadic_url.py ....................                          [ 90%]
425
tests/test_widgets.py .....................                              [ 92%]
426
tests/test_workflow_import.py ..............................             [ 94%]
427
tests/test_workflows.py ................................................ [ 97%]
428
.......................                                                  [ 99%]
429
tests/test_wscall.py .....                                               [ 99%]
430
tests/test_x509utils.py .                                                [100%]
431

    
432
=================================== FAILURES ===================================
433
_______________________ test_settings_filetypes[pickle] ________________________
434

    
435
pub = <wcs.compat.CompatWcsPublisher object at 0x7f249ccde190>
436

    
437
    def test_settings_filetypes(pub):
438
        create_superuser(pub)
439
        app = login(get_app(pub))
440
    
441
        resp = app.get('/backoffice/settings/filetypes/')
442
        assert 'There are no file type defined at the moment.' in resp.body
443
        resp.forms[0]['label'] = 'Text files'
444
        resp.forms[0]['mimetypes'] = '.odt'
445
        resp = resp.forms[0].submit('submit')
446
        assert resp.location == 'http://example.net/backoffice/settings/filetypes/'
447
        resp = resp.follow()
448
        assert pub.cfg['filetypes'][1]['label'] == 'Text files'
449
    
450
        resp = resp.click('Text files')
451
        assert resp.forms[0]['mimetypes'].value == 'application/vnd.oasis.opendocument.text'
452
        resp.forms[0]['mimetypes'] = 'application/vnd.oasis.opendocument.text, .doc, .docx, .pdf'
453
        resp = resp.forms[0].submit('submit')
454
        assert resp.location == 'http://example.net/backoffice/settings/filetypes/'
455
        resp = resp.follow()
456
>       assert 'application/msword (.doc)' in resp.body
457
E       assert 'application/msword (.doc)' in '<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset="utf-8"/>\n    <title>Back Office of wcs - File Types</title>\n ...  <div id="footer">\n    w.c.s. \xe2\x80\x94 Copyright \xc2\xa9 Entr\'ouvert\n  </div>\n\n  \n  \n  </body>\n</html>\n'
458
E        +  where '<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset="utf-8"/>\n    <title>Back Office of wcs - File Types</title>\n ...  <div id="footer">\n    w.c.s. \xe2\x80\x94 Copyright \xc2\xa9 Entr\'ouvert\n  </div>\n\n  \n  \n  </body>\n</html>\n' = <200 OK text/html body='<!DOCTYPE...l>\n'/3990>.body
459

    
460
tests/test_admin_pages.py:4071: AssertionError
461
_________________________ test_settings_filetypes[sql] _________________________
462

    
463
pub = <wcs.compat.CompatWcsPublisher object at 0x7f249d0c4c50>
464

    
465
    def test_settings_filetypes(pub):
466
        create_superuser(pub)
467
        app = login(get_app(pub))
468
    
469
        resp = app.get('/backoffice/settings/filetypes/')
470
        assert 'There are no file type defined at the moment.' in resp.body
471
        resp.forms[0]['label'] = 'Text files'
472
        resp.forms[0]['mimetypes'] = '.odt'
473
        resp = resp.forms[0].submit('submit')
474
        assert resp.location == 'http://example.net/backoffice/settings/filetypes/'
475
        resp = resp.follow()
476
        assert pub.cfg['filetypes'][1]['label'] == 'Text files'
477
    
478
        resp = resp.click('Text files')
479
        assert resp.forms[0]['mimetypes'].value == 'application/vnd.oasis.opendocument.text'
480
        resp.forms[0]['mimetypes'] = 'application/vnd.oasis.opendocument.text, .doc, .docx, .pdf'
481
        resp = resp.forms[0].submit('submit')
482
        assert resp.location == 'http://example.net/backoffice/settings/filetypes/'
483
        resp = resp.follow()
484
>       assert 'application/msword (.doc)' in resp.body
485
E       assert 'application/msword (.doc)' in '<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset="utf-8"/>\n    <title>Back Office of wcs - File Types</title>\n ...  <div id="footer">\n    w.c.s. \xe2\x80\x94 Copyright \xc2\xa9 Entr\'ouvert\n  </div>\n\n  \n  \n  </body>\n</html>\n'
486
E        +  where '<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset="utf-8"/>\n    <title>Back Office of wcs - File Types</title>\n ...  <div id="footer">\n    w.c.s. \xe2\x80\x94 Copyright \xc2\xa9 Entr\'ouvert\n  </div>\n\n  \n  \n  </body>\n</html>\n' = <200 OK text/html body='<!DOCTYPE...l>\n'/3990>.body
487

    
488
tests/test_admin_pages.py:4071: AssertionError
489
__________________________ test_home_keywords[pickle] __________________________
490

    
491
pub = <wcs.compat.CompatWcsPublisher object at 0x7f249c132810>
492

    
493
    def test_home_keywords(pub):
494
        formdef = create_formdef()
495
        formdef.category_id = '1'
496
        formdef.keywords = 'hello, world'
497
        formdef.store()
498
        home = get_app(pub).get('/')
499
>       assert '<div data-keywords="hello ' in home.body or '<div data-keywords="world ' in home.body
500
E       assert ('<div data-keywords="hello ' in '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms</title>\n<link rel="stylesheet" type="text/css" href="/static.../li></ul></div><p id="login"><a href="/login">Login</a></p>\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>' or '<div data-keywords="world ' in '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms</title>\n<link rel="stylesheet" type="text/css" href="/static.../li></ul></div><p id="login"><a href="/login">Login</a></p>\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>')
501
E        +  where '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms</title>\n<link rel="stylesheet" type="text/css" href="/static.../li></ul></div><p id="login"><a href="/login">Login</a></p>\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>' = <200 OK text/html body='<!DOCTYPE...tml>'/559>.body
502
E        +  and   '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms</title>\n<link rel="stylesheet" type="text/css" href="/static.../li></ul></div><p id="login"><a href="/login">Login</a></p>\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>' = <200 OK text/html body='<!DOCTYPE...tml>'/559>.body
503

    
504
tests/test_form_pages.py:215: AssertionError
505
___________________________ test_home_keywords[sql] ____________________________
506

    
507
pub = <wcs.compat.CompatWcsPublisher object at 0x7f249ccde150>
508

    
509
    def test_home_keywords(pub):
510
        formdef = create_formdef()
511
        formdef.category_id = '1'
512
        formdef.keywords = 'hello, world'
513
        formdef.store()
514
        home = get_app(pub).get('/')
515
>       assert '<div data-keywords="hello ' in home.body or '<div data-keywords="world ' in home.body
516
E       assert ('<div data-keywords="hello ' in '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms</title>\n<link rel="stylesheet" type="text/css" href="/static.../li></ul></div><p id="login"><a href="/login">Login</a></p>\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>' or '<div data-keywords="world ' in '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms</title>\n<link rel="stylesheet" type="text/css" href="/static.../li></ul></div><p id="login"><a href="/login">Login</a></p>\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>')
517
E        +  where '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms</title>\n<link rel="stylesheet" type="text/css" href="/static.../li></ul></div><p id="login"><a href="/login">Login</a></p>\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>' = <200 OK text/html body='<!DOCTYPE...tml>'/559>.body
518
E        +  and   '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms</title>\n<link rel="stylesheet" type="text/css" href="/static.../li></ul></div><p id="login"><a href="/login">Login</a></p>\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>' = <200 OK text/html body='<!DOCTYPE...tml>'/559>.body
519

    
520
tests/test_form_pages.py:215: AssertionError
521
_________________ test_item_field_with_disabled_items[pickle] __________________
522

    
523
http_requests = <utilities.HttpRequestsMocking object at 0x7f249ce86c90>
524
pub = <wcs.compat.CompatWcsPublisher object at 0x7f249cf0f450>
525

    
526
    def test_item_field_with_disabled_items(http_requests, pub):
527
        user = create_user(pub)
528
        formdef = create_formdef()
529
        formdef.data_class().wipe()
530
        ds = {'type': 'json', 'value': 'http://remote.example.net/json'}
531
        formdef.fields = [fields.ItemField(id='0', label='string', type='item',
532
            data_source=ds, display_disabled_items=True)]
533
        formdef.store()
534
    
535
        with mock.patch('qommon.misc.urlopen') as urlopen:
536
            data = {'data': [{'id': '1', 'text': 'hello'}, {'id': '2', 'text': 'world'}]}
537
            urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
538
            resp = get_app(pub).get('/test/')
539
            resp.form['f0'] = '1'
540
            resp.form['f0'] = '2'
541
            resp = resp.form.submit('submit') # -> validation page
542
            resp = resp.form.submit('submit') # -> submit
543
            assert formdef.data_class().select()[0].data['0'] == '2'
544
            assert formdef.data_class().select()[0].data['0_display'] == 'world'
545
    
546
        formdef.data_class().wipe()
547
    
548
        with mock.patch('qommon.misc.urlopen') as urlopen:
549
            data = {'data': [{'id': '1', 'text': 'hello', 'disabled': True}, {'id': '2', 'text': 'world'}]}
550
            urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
551
            resp = get_app(pub).get('/test/')
552
            assert '<option disabled="disabled" value="1">hello</option>' in resp.body
553
            resp.form['f0'] = '1'
554
            resp.form['f0'] = '2'
555
            resp = resp.form.submit('submit') # -> validation page
556
            resp = resp.form.submit('submit') # -> submit
557
            assert formdef.data_class().select()[0].data['0'] == '2'
558
            assert formdef.data_class().select()[0].data['0_display'] == 'world'
559
    
560
            resp = get_app(pub).get('/test/')
561
            assert '<option disabled="disabled" value="1">hello</option>' in resp.body
562
            resp.form['f0'] = '1'
563
            resp = resp.form.submit('submit') # -> validation page
564
            assert 'There were errors processing the form' in resp.body
565
    
566
        formdef.data_class().wipe()
567
        formdef.fields = [fields.ItemField(id='0', label='string', type='item', data_source=ds,
568
            display_disabled_items=False)]
569
        formdef.store()
570
    
571
        with mock.patch('qommon.misc.urlopen') as urlopen:
572
            data = {'data': [{'id': '1', 'text': 'hello', 'disabled': True}, {'id': '2', 'text': 'world'}]}
573
            urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
574
            resp = get_app(pub).get('/test/')
575
            assert not '<option disabled="disabled" value="1">hello</option>' in resp.body
576
            resp.form['f0'] = '2'
577
            resp = resp.form.submit('submit') # -> validation page
578
            resp = resp.form.submit('submit') # -> submit
579
            assert formdef.data_class().select()[0].data['0'] == '2'
580
            assert formdef.data_class().select()[0].data['0_display'] == 'world'
581
    
582
        formdef.data_class().wipe()
583
        formdef.fields = [fields.ItemField(id='0', label='string', type='item',
584
            data_source=ds, show_as_radio=True, display_disabled_items=True)]
585
        formdef.store()
586
    
587
        with mock.patch('qommon.misc.urlopen') as urlopen:
588
            data = {'data': [{'id': '1', 'text': 'hello'}, {'id': '2', 'text': 'world'}]}
589
            urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
590
            resp = get_app(pub).get('/test/')
591
            resp.form['f0'] = '1'
592
            resp.form['f0'] = '2'
593
            resp = resp.form.submit('submit') # -> validation page
594
            resp = resp.form.submit('submit') # -> submit
595
            assert formdef.data_class().select()[0].data['0'] == '2'
596
            assert formdef.data_class().select()[0].data['0_display'] == 'world'
597
    
598
        formdef.data_class().wipe()
599
    
600
        with mock.patch('qommon.misc.urlopen') as urlopen:
601
            data = {'data': [{'id': '1', 'text': 'hello', 'disabled': True}, {'id': '2', 'text': 'world'}]}
602
            urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
603
            resp = get_app(pub).get('/test/')
604
>           assert '<input disabled="disabled" type="radio" name="f0" value="1" />' in resp.body
605
E           assert '<input disabled="disabled" type="radio" name="f0" value="1" />' in '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms - test</title>\n<link rel="stylesheet" type="text/css" href="...utton></div></div>\n</div></form><br class="quixoteform" />\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>'
606
E            +  where '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms - test</title>\n<link rel="stylesheet" type="text/css" href="...utton></div></div>\n</div></form><br class="quixoteform" />\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>' = <200 OK text/html body='<!DOCTYPE...tml>'/1887>.body
607

    
608
tests/test_form_pages.py:4379: AssertionError
609
___________________ test_item_field_with_disabled_items[sql] ___________________
610

    
611
http_requests = <utilities.HttpRequestsMocking object at 0x7f249cfabdd0>
612
pub = <wcs.compat.CompatWcsPublisher object at 0x7f249cfab550>
613

    
614
    def test_item_field_with_disabled_items(http_requests, pub):
615
        user = create_user(pub)
616
        formdef = create_formdef()
617
        formdef.data_class().wipe()
618
        ds = {'type': 'json', 'value': 'http://remote.example.net/json'}
619
        formdef.fields = [fields.ItemField(id='0', label='string', type='item',
620
            data_source=ds, display_disabled_items=True)]
621
        formdef.store()
622
    
623
        with mock.patch('qommon.misc.urlopen') as urlopen:
624
            data = {'data': [{'id': '1', 'text': 'hello'}, {'id': '2', 'text': 'world'}]}
625
            urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
626
            resp = get_app(pub).get('/test/')
627
            resp.form['f0'] = '1'
628
            resp.form['f0'] = '2'
629
            resp = resp.form.submit('submit') # -> validation page
630
            resp = resp.form.submit('submit') # -> submit
631
            assert formdef.data_class().select()[0].data['0'] == '2'
632
            assert formdef.data_class().select()[0].data['0_display'] == 'world'
633
    
634
        formdef.data_class().wipe()
635
    
636
        with mock.patch('qommon.misc.urlopen') as urlopen:
637
            data = {'data': [{'id': '1', 'text': 'hello', 'disabled': True}, {'id': '2', 'text': 'world'}]}
638
            urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
639
            resp = get_app(pub).get('/test/')
640
            assert '<option disabled="disabled" value="1">hello</option>' in resp.body
641
            resp.form['f0'] = '1'
642
            resp.form['f0'] = '2'
643
            resp = resp.form.submit('submit') # -> validation page
644
            resp = resp.form.submit('submit') # -> submit
645
            assert formdef.data_class().select()[0].data['0'] == '2'
646
            assert formdef.data_class().select()[0].data['0_display'] == 'world'
647
    
648
            resp = get_app(pub).get('/test/')
649
            assert '<option disabled="disabled" value="1">hello</option>' in resp.body
650
            resp.form['f0'] = '1'
651
            resp = resp.form.submit('submit') # -> validation page
652
            assert 'There were errors processing the form' in resp.body
653
    
654
        formdef.data_class().wipe()
655
        formdef.fields = [fields.ItemField(id='0', label='string', type='item', data_source=ds,
656
            display_disabled_items=False)]
657
        formdef.store()
658
    
659
        with mock.patch('qommon.misc.urlopen') as urlopen:
660
            data = {'data': [{'id': '1', 'text': 'hello', 'disabled': True}, {'id': '2', 'text': 'world'}]}
661
            urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
662
            resp = get_app(pub).get('/test/')
663
            assert not '<option disabled="disabled" value="1">hello</option>' in resp.body
664
            resp.form['f0'] = '2'
665
            resp = resp.form.submit('submit') # -> validation page
666
            resp = resp.form.submit('submit') # -> submit
667
            assert formdef.data_class().select()[0].data['0'] == '2'
668
            assert formdef.data_class().select()[0].data['0_display'] == 'world'
669
    
670
        formdef.data_class().wipe()
671
        formdef.fields = [fields.ItemField(id='0', label='string', type='item',
672
            data_source=ds, show_as_radio=True, display_disabled_items=True)]
673
        formdef.store()
674
    
675
        with mock.patch('qommon.misc.urlopen') as urlopen:
676
            data = {'data': [{'id': '1', 'text': 'hello'}, {'id': '2', 'text': 'world'}]}
677
            urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
678
            resp = get_app(pub).get('/test/')
679
            resp.form['f0'] = '1'
680
            resp.form['f0'] = '2'
681
            resp = resp.form.submit('submit') # -> validation page
682
            resp = resp.form.submit('submit') # -> submit
683
            assert formdef.data_class().select()[0].data['0'] == '2'
684
            assert formdef.data_class().select()[0].data['0_display'] == 'world'
685
    
686
        formdef.data_class().wipe()
687
    
688
        with mock.patch('qommon.misc.urlopen') as urlopen:
689
            data = {'data': [{'id': '1', 'text': 'hello', 'disabled': True}, {'id': '2', 'text': 'world'}]}
690
            urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
691
            resp = get_app(pub).get('/test/')
692
>           assert '<input disabled="disabled" type="radio" name="f0" value="1" />' in resp.body
693
E           assert '<input disabled="disabled" type="radio" name="f0" value="1" />' in '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms - test</title>\n<link rel="stylesheet" type="text/css" href="...utton></div></div>\n</div></form><br class="quixoteform" />\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>'
694
E            +  where '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>Forms - test</title>\n<link rel="stylesheet" type="text/css" href="...utton></div></div>\n</div></form><br class="quixoteform" />\n</div>\n<div id="footer"></div>\n</div>\n</body>\n</html>' = <200 OK text/html body='<!DOCTYPE...tml>'/1887>.body
695

    
696
tests/test_form_pages.py:4379: AssertionError
697
____________________________ test_format_mimetypes _____________________________
698

    
699
    def test_format_mimetypes():
700
        assert FileTypesDirectory.format_mimetypes(['application/pdf']) == \
701
                'application/pdf (.pdf)'
702
        assert FileTypesDirectory.format_mimetypes(['application/pdf', 'text/rtf']) == \
703
                'application/pdf (.pdf), text/rtf'
704
>       assert FileTypesDirectory.format_mimetypes(['application/pdf', 'application/msword']) == \
705
                'application/pdf (.pdf), application/msword (.doc)'
706
E       AssertionError: assert 'application/...msword (.dot)' == 'application/p...msword (.doc)'
707
E         Skipping 37 identical leading characters in diff, use -v to show
708
E         - sword (.dot)
709
E         ?           ^
710
E         + sword (.doc)
711
E         ?           ^
712

    
713
tests/test_misc.py:70: AssertionError
714
_______________________ test_prefill_formula_time_value ________________________
715

    
716
    def test_prefill_formula_time_value():
717
        pub.substitutions.get_context_variables = lambda: {}
718
        field = fields.Field()
719
        field.prefill = {'type': 'formula', 'value': 'utils.make_datetime("2018-04-04 10:05").time()'}
720
>       assert field.get_prefill_value() == ('10:05 a.m.', False)
721
E       AssertionError: assert ('10:05', False) == ('10:05 a.m.', False)
722
E         At index 0 diff: '10:05' != '10:05 a.m.'
723
E         Use -v to get the full diff
724

    
725
tests/test_prefill.py:105: AssertionError
726
----------- generated xml file: /home/chris/src/wcs/test_results.xml -----------
727

    
728
---------- coverage: platform linux2, python 2.7.13-final-0 ----------
729
Coverage XML written to file coverage.xml
730

    
731
============= 8 failed, 1383 passed, 20 skipped in 519.41 seconds ==============
732
ERROR: InvocationError: '/tmp/tox-chris/wcs/coverage-py27-django111-pylint-pg/bin/py.test --junit-xml=test_results.xml --cov=wcs --cov-report xml --cov-config .coveragerc tests'
733
___________________________________ summary ____________________________________
734
ERROR:   coverage-py27-django18-pylint-pg: commands failed
735
ERROR:   coverage-py27-django111-pylint-pg: commands failed