Projet

Général

Profil

0009-misc-pylint-fix-unneeded-not-52630.patch

Lauréline Guérin, 02 avril 2021 17:21

Télécharger (44,2 ko)

Voir les différences:

Subject: [PATCH 09/18] misc: pylint fix unneeded-not (#52630)

 tests/admin_pages/test_form.py     |  10 +--
 tests/backoffice_pages/test_all.py | 126 ++++++++++++++---------------
 tests/form_pages/test_all.py       |  88 ++++++++++----------
 tests/test_hobo.py                 |   4 +-
 tests/test_misc.py                 |   2 +-
 tests/test_publisher.py            |   4 +-
 tests/test_sql.py                  |   2 +-
 tests/test_widgets.py              |   4 +-
 tests/test_wscall.py               |   6 +-
 9 files changed, 123 insertions(+), 123 deletions(-)
tests/admin_pages/test_form.py
111 111
def assert_option_display(resp, label, value):
112 112
    option_line = re.findall('%s.*%s' % (label, value), resp.text, re.DOTALL)
113 113
    assert option_line
114
    assert not '</li>' in option_line
114
    assert '</li>' not in option_line
115 115

  
116 116

  
117 117
def test_forms_edit(pub):
......
281 281
    resp = resp.click('change title')
282 282
    assert resp.form['name'].value == 'form title'
283 283
    assert 'data-slug-sync' in resp.text
284
    assert not 'change-nevertheless' in resp.text
284
    assert 'change-nevertheless' not in resp.text
285 285
    resp.form['name'] = 'new title'
286 286
    resp = resp.form.submit()
287 287
    assert resp.location == 'http://example.net/backoffice/forms/1/'
......
293 293

  
294 294
    resp = app.get('/backoffice/forms/1/')
295 295
    resp = resp.click('change title')
296
    assert not 'data-slug-sync' in resp.text
297
    assert not 'change-nevertheless' in resp.text
296
    assert 'data-slug-sync' not in resp.text
297
    assert 'change-nevertheless' not in resp.text
298 298

  
299 299
    formdef.data_class()().store()
300 300
    resp = app.get('/backoffice/forms/1/')
......
573 573
    resp = app.get('/backoffice/forms/1/')
574 574
    resp = resp.click(href=re.compile('^roles$'))
575 575
    resp.form['roles$element0'] = 'logged-users'
576
    assert not 'required_authentication_contexts' in resp.text
576
    assert 'required_authentication_contexts' not in resp.text
577 577
    resp = resp.form.submit()
578 578
    assert FormDef.get(formdef.id).roles == ['logged-users']
579 579

  
tests/backoffice_pages/test_all.py
255 255
    resp = app.get('/backoffice/')
256 256
    resp = resp.click('Management', index=0)
257 257
    resp = resp.follow()
258
    assert not 'Forms in your care' in resp.text
258
    assert 'Forms in your care' not in resp.text
259 259
    assert re.findall('Other Forms.*form-title', resp.text)
260 260

  
261 261
    # 2nd time with user set as receiver of the forms
......
582 582
    resp = app.get('/backoffice/management/form-title/')
583 583
    assert resp.text.count('</th>') == 8  # six columns
584 584
    resp.forms['listing-settings']['1'].checked = False
585
    assert not 'submission_channel' in resp.forms['listing-settings'].fields
585
    assert 'submission_channel' not in resp.forms['listing-settings'].fields
586 586
    assert 'last_update_time' in resp.forms['listing-settings'].fields
587 587
    resp = resp.forms['listing-settings'].submit()
588 588
    assert resp.text.count('</th>') == 7  # fixe columns
......
630 630

  
631 631
    app = login(get_app(pub))
632 632
    resp = app.get('/backoffice/management/form-title/')
633
    assert not 'submission_agent' in resp.forms['listing-settings'].fields
633
    assert 'submission_agent' not in resp.forms['listing-settings'].fields
634 634

  
635 635
    formdef = FormDef.get_by_urlname('form-title')
636 636
    formdef.backoffice_submission_roles = user.roles
......
641 641
    resp = resp.forms['listing-settings'].submit()
642 642
    assert resp.text.count('</th>') == 9  # seven columns
643 643
    assert resp.text.count('data-link') == 17  # 17 rows
644
    assert not '>agent<' in resp.text
644
    assert '>agent<' not in resp.text
645 645
    resp = resp.click('Export as CSV File')
646 646
    assert len(resp.text.splitlines()) == 18  # 17 + header line
647
    assert not ',agent,' in resp.text
647
    assert ',agent,' not in resp.text
648 648

  
649 649
    for formdata in formdef.data_class().select():
650 650
        formdata.submission_agent_id = str(agent.id)
......
877 877
    create_environment(pub)
878 878
    app = login(get_app(pub))
879 879
    resp = app.get('/backoffice/management/form-title/')
880
    assert not 'filter-2-value' in resp.forms['listing-settings'].fields
880
    assert 'filter-2-value' not in resp.forms['listing-settings'].fields
881 881

  
882 882
    formdef = FormDef.get_by_urlname('form-title')
883 883
    formdef.fields[1].in_filters = True
......
891 891
    )
892 892
    formdef.store()
893 893
    resp = app.get('/backoffice/management/form-title/')
894
    assert not 'filter-4-value' in resp.forms['listing-settings'].fields
894
    assert 'filter-4-value' not in resp.forms['listing-settings'].fields
895 895

  
896 896
    formdef.fields[-1].in_filters = True
897 897
    formdef.store()
......
1489 1489
    assert 'Resolution time' in resp.text
1490 1490
    assert 'To Status &quot;New&quot;' in resp.text
1491 1491
    assert 'To Status &quot;Finished&quot;' in resp.text
1492
    assert not '<h2>Filters</h2>' in resp.text
1492
    assert '<h2>Filters</h2>' not in resp.text
1493 1493

  
1494 1494
    resp.forms['listing-settings']['filter-end-value'] = '2013-01-01'
1495 1495
    resp = resp.forms['listing-settings'].submit()
......
1564 1564
    workflow.store()
1565 1565
    resp = app.get('/backoffice/management/form-title/')
1566 1566
    assert 'id="multi-actions"' in resp.text
1567
    assert not 'OTHER ACTION' in resp.text
1567
    assert 'OTHER ACTION' not in resp.text
1568 1568

  
1569 1569
    # action for function
1570 1570
    trigger.roles = ['_foobar']
......
1772 1772
    resp = app.get('/backoffice/management/form-title/')
1773 1773
    resp = resp.click('Statistics')
1774 1774
    assert 'filter' not in resp.forms['listing-settings'].fields  # status is not displayed by default
1775
    assert not '<h2>Filters</h2>' in resp.text
1775
    assert '<h2>Filters</h2>' not in resp.text
1776 1776

  
1777 1777
    # add 'status' as a filter
1778 1778
    resp.forms['listing-settings']['filter-status'].checked = True
1779 1779
    resp = resp.forms['listing-settings'].submit()
1780 1780
    assert 'filter' in resp.forms['listing-settings'].fields
1781
    assert not '<h2>Filters</h2>' in resp.text
1781
    assert '<h2>Filters</h2>' not in resp.text
1782 1782

  
1783 1783
    assert resp.forms['listing-settings']['filter'].value == 'all'
1784 1784
    resp.forms['listing-settings']['filter'].value = 'pending'
......
1810 1810
    app = login(get_app(pub))
1811 1811
    resp = app.get('/backoffice/management/form-title/')
1812 1812
    resp = resp.click('Statistics')
1813
    assert not 'filter-2-value' in resp.form.fields
1813
    assert 'filter-2-value' not in resp.form.fields
1814 1814

  
1815 1815
    resp.forms['listing-settings']['filter-2'].checked = True
1816 1816
    resp = resp.forms['listing-settings'].submit()
......
1863 1863
    assert re.findall('<tbody.*\/tbody>', resp.text, re.DOTALL)[0].count('<tr') == 17
1864 1864

  
1865 1865
    # check there's no link to map the sidebar
1866
    assert not 'Plot on a Map' in resp.text
1866
    assert 'Plot on a Map' not in resp.text
1867 1867

  
1868 1868
    formdef = FormDef.get_by_urlname('form-title')
1869 1869
    formdef.geolocations = {'base': 'Geolocafoobar'}
......
2037 2037
    assert (' with the number %s.' % number31.get_display_id()) in resp.text
2038 2038

  
2039 2039
    # check there's nothing in the sidebar
2040
    assert not 'Channel' in resp.text
2040
    assert 'Channel' not in resp.text
2041 2041

  
2042 2042
    number31.submission_channel = 'mail'
2043 2043
    number31.user_id = user.id
......
2137 2137
    assert (' with the number %s.' % number31.get_display_id()) in resp.text
2138 2138

  
2139 2139
    # check there's nothing in the sidebar
2140
    assert not 'Geolocation' in resp.text
2140
    assert 'Geolocation' not in resp.text
2141 2141

  
2142 2142
    number31.geolocations = {'base': {'lat': 48.83, 'lon': 2.32}}
2143 2143
    number31.store()
......
2185 2185
    resp = app.get('/backoffice/management/form-title/%s/' % number31.id)
2186 2186
    assert (' with the number %s.' % number31.get_display_id()) in resp.text
2187 2187
    assert 'CLICK ME!' in resp.text
2188
    assert not 'CLICK ME2!' in resp.text
2189
    assert not 'backoffice-description' in resp.text
2188
    assert 'CLICK ME2!' not in resp.text
2189
    assert 'backoffice-description' not in resp.text
2190 2190

  
2191 2191
    # add an info text to the status
2192 2192
    st1.backoffice_info_text = '<p>Foo</p>'
......
2214 2214
    app2 = login(get_app(pub), username='foobar', password='foobar')
2215 2215
    resp = app2.get('/backoffice/management/form-title/%s/' % number31.id)
2216 2216
    assert 'Be warned forms of this user are also being looked' in resp.text
2217
    assert not 'backoffice-description' in resp.text
2218
    assert not 'CLICK ME!' in resp.text
2219
    assert not 'CLICK ME2!' in resp.text
2217
    assert 'backoffice-description' not in resp.text
2218
    assert 'CLICK ME!' not in resp.text
2219
    assert 'CLICK ME2!' not in resp.text
2220 2220

  
2221 2221
    # remove info text from the status
2222 2222
    st1.backoffice_info_text = None
2223 2223
    workflow.store()
2224 2224
    resp = app.get('/backoffice/management/form-title/%s/' % number31.id)
2225 2225
    assert 'backoffice-description' in resp.text
2226
    assert not '<p>Foo</p>' in resp.text
2226
    assert '<p>Foo</p>' not in resp.text
2227 2227
    assert '<p>Bar</p>' in resp.text
2228 2228

  
2229 2229
    # add info text to second button
......
2231 2231
    workflow.store()
2232 2232
    resp = app.get('/backoffice/management/form-title/%s/' % number31.id)
2233 2233
    assert 'backoffice-description' in resp.text
2234
    assert not '<p>Foo</p>' in resp.text
2234
    assert '<p>Foo</p>' not in resp.text
2235 2235
    assert '<p>Bar</p>' in resp.text
2236
    assert not '<p>Baz</p>' in resp.text
2236
    assert '<p>Baz</p>' not in resp.text
2237 2237

  
2238 2238
    # remove info text from first button
2239 2239
    commentable.backoffice_info_text = None
2240 2240
    workflow.store()
2241 2241
    resp = app.get('/backoffice/management/form-title/%s/' % number31.id)
2242
    assert not 'backoffice-description' in resp.text
2242
    assert 'backoffice-description' not in resp.text
2243 2243

  
2244 2244

  
2245 2245
def test_backoffice_handling_post_dispatch(pub):
......
2257 2257

  
2258 2258
    # check there's no access at the moment
2259 2259
    resp = app.get('/backoffice/management/').follow()
2260
    assert not 'form-title/' in resp.text
2260
    assert 'form-title/' not in resp.text
2261 2261
    resp = app.get('/backoffice/management/form-title/', status=403)
2262 2262
    resp = app.get('/backoffice/management/form-title/%s/' % number31.id, status=403)
2263 2263

  
......
2354 2354
    # the failure message shouldn't be displayed in the frontoffice
2355 2355
    resp = app.get('/form-title/%s/' % number31.id)
2356 2356
    assert (' with the number %s.' % number31.get_display_id()) in resp.text
2357
    assert not 'Error during webservice call' in resp.text
2357
    assert 'Error during webservice call' not in resp.text
2358 2358

  
2359 2359

  
2360 2360
@pytest.mark.parametrize('notify_on_errors', [True, False])
......
2537 2537
    resp = resp.form.submit('button_wfedit')
2538 2538
    resp = resp.follow()
2539 2539
    assert 'http://www.example.com/test.pdf' in resp.text  # make sure sidebar has details
2540
    assert not 'Tracking Code' in resp.text  # make sure it doesn't display a tracking code
2540
    assert 'Tracking Code' not in resp.text  # make sure it doesn't display a tracking code
2541 2541
    assert resp.form['f1'].value == number31.data['1']
2542 2542
    assert resp.form['f2'].value == number31.data['2']
2543 2543
    assert resp.form['f3'].value == number31.data['3']
......
2960 2960
    assert 'Global View' in resp.text
2961 2961
    resp = resp.click('Global View')
2962 2962
    assert resp.text[resp.text.index('<tbody') :].count('<tr') == 20
2963
    assert not 'Map View' in resp.text
2963
    assert 'Map View' not in resp.text
2964 2964

  
2965 2965
    resp = app.get('/backoffice/management/listing?limit=500')
2966 2966
    assert resp.text[resp.text.index('<tbody') :].count('<tr') == 37  # 17 formdef1 + 20 formdef2
......
2979 2979

  
2980 2980
    assert resp.text[resp.text.index('<tbody') :].count('<tr') == 20
2981 2981
    assert 'http://example.net/backoffice/management/other-form/' in resp.text
2982
    assert not 'http://example.net/backoffice/management/form-title/' in resp.text
2982
    assert 'http://example.net/backoffice/management/form-title/' not in resp.text
2983 2983

  
2984 2984
    formdef = FormDef.get_by_urlname('form-title')
2985 2985
    last_update_time = formdef.data_class().select(lambda x: not x.is_draft())[0].last_update_time
......
2999 2999
    assert 'digest of number &lt;%s&gt;' % formdata.id_display in resp.text
3000 3000

  
3001 3001
    # check a Channel column is added when welco is available
3002
    assert not 'Channel' in resp.text
3002
    assert 'Channel' not in resp.text
3003 3003

  
3004 3004
    if not pub.site_options.has_section('variables'):
3005 3005
        pub.site_options.add_section('variables')
......
3053 3053
    resp.forms['listing-settings']['status'] = 'waiting'
3054 3054
    resp = resp.forms['listing-settings'].submit()
3055 3055
    assert resp.text[resp.text.index('<tbody') :].count('<tr') == 20
3056
    assert not 'form-title' in resp.text
3056
    assert 'form-title' not in resp.text
3057 3057
    resp.forms['listing-settings']['status'] = 'open'
3058 3058
    resp = resp.forms['listing-settings'].submit()
3059 3059
    assert resp.text[resp.text.index('<tbody') :].count('<tr') == 20
3060
    assert not 'form-title' in resp.text
3060
    assert 'form-title' not in resp.text
3061 3061
    resp.forms['listing-settings']['status'] = 'all'
3062 3062
    resp = resp.forms['listing-settings'].submit()
3063 3063
    assert resp.text[resp.text.index('<tbody') :].count('<tr') == 20
3064
    assert not 'form-title' in resp.text
3064
    assert 'form-title' not in resp.text
3065 3065
    resp.forms['listing-settings']['status'] = 'done'
3066 3066
    resp = resp.forms['listing-settings'].submit()
3067 3067
    assert resp.text[resp.text.index('<tbody') :].count('<tr') == 0
3068
    assert not 'form-title' in resp.text
3068
    assert 'form-title' not in resp.text
3069 3069

  
3070 3070

  
3071 3071
def test_global_listing_parameters_from_query_string(pub):
......
3166 3166

  
3167 3167
    app = login(get_app(pub))
3168 3168
    resp = app.get('/backoffice/management/listing?limit=500')
3169
    assert not 'category_id' in resp.forms['listing-settings'].fields
3169
    assert 'category_id' not in resp.forms['listing-settings'].fields
3170 3170

  
3171 3171
    cat1 = Category(name='cat1')
3172 3172
    cat1.store()
......
3187 3187

  
3188 3188
    resp.forms['listing-settings']['category_id'] = cat1.id
3189 3189
    resp = resp.forms['listing-settings'].submit()
3190
    assert not 'management/other-form/' in resp.text
3190
    assert 'management/other-form/' not in resp.text
3191 3191
    assert 'management/form-title/' in resp.text
3192 3192

  
3193 3193
    resp.forms['listing-settings']['category_id'] = cat2.id
3194 3194
    resp = resp.forms['listing-settings'].submit()
3195 3195
    assert 'management/other-form/' in resp.text
3196
    assert not 'management/form-title/' in resp.text
3196
    assert 'management/form-title/' not in resp.text
3197 3197

  
3198 3198

  
3199 3199
def test_datetime_in_global_listing(pub):
......
3406 3406
    assert (' with the number %s.' % number31.get_display_id()) in resp.text
3407 3407

  
3408 3408
    # check there's nothing in the sidebar
3409
    assert not '/user-pending-forms' in resp.text
3409
    assert '/user-pending-forms' not in resp.text
3410 3410

  
3411 3411
    number31.formdef.digest_template = 'digest of number {{form_number}}'
3412 3412
    number31.user_id = user.id
......
3415 3415
    assert '/user-pending-forms' in resp.text
3416 3416
    user_pending_form_url = re.findall('data-async-url="(.*/user-pending-forms)"', resp.text)[0]
3417 3417
    partial_resp = app.get(user_pending_form_url)
3418
    assert not number31.get_url(backoffice=True) in partial_resp.text
3418
    assert number31.get_url(backoffice=True) not in partial_resp.text
3419 3419
    assert number31.digest in partial_resp.text
3420 3420
    assert '<span class="formname">%s</span>' % number31.formdef.name in partial_resp.text
3421 3421

  
......
3428 3428
    assert '/user-pending-forms' in resp.text
3429 3429
    user_pending_form_url = re.findall('data-async-url="(.*/user-pending-forms)"', resp.text)[0]
3430 3430
    partial_resp = app.get(user_pending_form_url)
3431
    assert not number31.get_url(backoffice=True) in partial_resp.text
3431
    assert number31.get_url(backoffice=True) not in partial_resp.text
3432 3432
    assert number34.get_url(backoffice=True) in partial_resp.text
3433 3433

  
3434 3434
    cat1 = Category(name='cat1')
......
3639 3639

  
3640 3640
    resp = app.get('/backoffice/management/users/%s/' % user.id)
3641 3641
    for item in to_match:
3642
        assert not item in resp.text  # not linked
3642
        assert item not in resp.text  # not linked
3643 3643
    assert resp.text.count('<li') == count_li
3644 3644

  
3645 3645
    # mark formdef so it's not listed in per-user view
......
3667 3667
    number31.store()
3668 3668

  
3669 3669
    resp = app.get('/backoffice/management/users/%s/' % user.id)
3670
    assert not 'Send tracking code' in resp.text
3670
    assert 'Send tracking code' not in resp.text
3671 3671

  
3672 3672
    formdef.enable_tracking_codes = True
3673 3673
    formdef.store()
......
3677 3677
    pub.cfg['sms'] = {}
3678 3678
    pub.write_cfg()
3679 3679
    resp = user_view_resp.click('Send tracking code')
3680
    assert not 'sms' in resp.form.fields
3680
    assert 'sms' not in resp.form.fields
3681 3681
    assert resp.form['email'].value == user.email
3682 3682

  
3683 3683
    resp = resp.form.submit()
......
3720 3720
    app = login(get_app(pub))
3721 3721
    resp = app.get('/backoffice/management/form-title/')
3722 3722
    first_link = re.findall('data-link="(\d+)/?"', resp.text)[0]
3723
    assert not 'backoffice-submission' in resp.text
3723
    assert 'backoffice-submission' not in resp.text
3724 3724

  
3725 3725
    formdata = FormDef.get_by_urlname('form-title').data_class().get(first_link)
3726 3726
    formdata.backoffice_submission = True
......
3739 3739

  
3740 3740
    app = login(get_app(pub))
3741 3741
    resp = app.get('/backoffice/management/listing?limit=100')
3742
    assert not 'backoffice-submission' in resp.text
3742
    assert 'backoffice-submission' not in resp.text
3743 3743

  
3744 3744
    formdef = FormDef.get_by_urlname('form-title')
3745 3745
    formdata = formdef.data_class().get(
......
3767 3767
    app = login(get_app(pub))
3768 3768
    resp = app.get('/backoffice/management/form-title/')
3769 3769
    first_link = re.findall('data-link="(\d+/)?"', resp.text)[0]
3770
    assert not 'advisory-lock' in resp.text
3770
    assert 'advisory-lock' not in resp.text
3771 3771

  
3772 3772
    app2 = login(get_app(pub), username='foobar', password='foobar')
3773 3773
    resp = app2.get('/backoffice/management/form-title/')
3774
    assert not 'advisory-lock' in resp.text
3774
    assert 'advisory-lock' not in resp.text
3775 3775

  
3776 3776
    resp = app.get('/backoffice/management/form-title/' + first_link)
3777 3777
    resp = app2.get('/backoffice/management/form-title/')
3778 3778
    assert 'advisory-lock' in resp.text
3779 3779
    resp = app.get('/backoffice/management/form-title/')
3780
    assert not 'advisory-lock' in resp.text
3780
    assert 'advisory-lock' not in resp.text
3781 3781

  
3782 3782
    if pub.is_using_postgresql():
3783 3783
        # check global view
3784 3784
        resp = app2.get('/backoffice/management/listing?limit=100')
3785 3785
        assert 'advisory-lock' in resp.text
3786 3786
        resp = app.get('/backoffice/management/listing?limit=100')
3787
        assert not 'advisory-lock' in resp.text
3787
        assert 'advisory-lock' not in resp.text
3788 3788

  
3789 3789
    resp = app.get('/backoffice/management/form-title/' + first_link)
3790
    assert not 'Be warned forms of this user are also being looked' in resp.text
3790
    assert 'Be warned forms of this user are also being looked' not in resp.text
3791 3791
    assert 'button_commentable' in resp.text
3792 3792
    assert len(resp.forms)
3793 3793
    resp = app2.get('/backoffice/management/form-title/' + first_link)
3794 3794
    assert 'Be warned forms of this user are also being looked' in resp.text
3795
    assert not 'button_commentable' in resp.text
3795
    assert 'button_commentable' not in resp.text
3796 3796
    assert len(resp.forms) == 0
3797 3797
    # revisit with first user, no change
3798 3798
    resp = app.get('/backoffice/management/form-title/' + first_link)
3799
    assert not 'Be warned forms of this user are also being looked' in resp.text
3799
    assert 'Be warned forms of this user are also being looked' not in resp.text
3800 3800
    assert 'button_commentable' in resp.text
3801 3801
    # back to second
3802 3802
    resp = app2.get('/backoffice/management/form-title/' + first_link)
3803 3803
    assert 'Be warned forms of this user are also being looked' in resp.text
3804
    assert not 'button_commentable' in resp.text
3804
    assert 'button_commentable' not in resp.text
3805 3805
    resp = resp.click('(unlock actions)')
3806 3806
    resp = resp.follow()
3807 3807
    assert 'Be warned forms of this user are also being looked' in resp.text
3808 3808
    assert 'button_commentable' in resp.text
3809
    assert not '(unlock actions)' in resp.text
3809
    assert '(unlock actions)' not in resp.text
3810 3810
    assert len(resp.forms)
3811 3811

  
3812 3812
    # submit action form
3813 3813
    resp.form['comment'] = 'HELLO'
3814 3814
    resp = resp.form.submit('button_commentable')
3815 3815
    # locks are reset after an action
3816
    assert not 'advisory-lock' in app2.get('/backoffice/management/form-title/')
3817
    assert not 'advisory-lock' in app.get('/backoffice/management/form-title/')
3816
    assert 'advisory-lock' not in app2.get('/backoffice/management/form-title/')
3817
    assert 'advisory-lock' not in app.get('/backoffice/management/form-title/')
3818 3818
    # but as the current user is redirected to the form, a lock will be
3819 3819
    # acquired (unless the user didn't have actions anymore, but it's not the
3820 3820
    # case here)
3821 3821
    resp = resp.follow()
3822
    assert not 'advisory-lock' in app2.get('/backoffice/management/form-title/')
3822
    assert 'advisory-lock' not in app2.get('/backoffice/management/form-title/')
3823 3823
    assert 'advisory-lock' in app.get('/backoffice/management/form-title/')
3824 3824

  
3825 3825

  
......
3858 3858

  
3859 3859
    app = login(get_app(pub))
3860 3860
    resp = app.get('/backoffice/management/form-title/%s/' % formdatas[0].id)
3861
    assert not 'Be warned forms of this user are also being looked' in resp.text
3861
    assert 'Be warned forms of this user are also being looked' not in resp.text
3862 3862
    app.get(re.findall('data-async-url="(.*/user-pending-forms)"', resp.text)[0])
3863 3863

  
3864 3864
    app2 = login(get_app(pub), username='foobar', password='foobar')
......
3873 3873

  
3874 3874
    # another by another user
3875 3875
    resp2 = app2.get('/backoffice/management/form-title/%s/' % formdatas[3].id)
3876
    assert not 'Be warned forms of this user are also being looked' in resp2.text
3876
    assert 'Be warned forms of this user are also being looked' not in resp2.text
3877 3877
    app2.get(re.findall('data-async-url="(.*/user-pending-forms)"', resp.text)[0])
3878 3878

  
3879 3879
    # check another formdef is only marked as visited if the user has potential
......
3884 3884
    other_formdata = second_formdef.data_class().get(other_formdatas[0].id)
3885 3885
    other_formdata.store()  # update concerned_roles
3886 3886

  
3887
    assert not 'formdata-other-form-%d' % other_formdata.id in session.visiting_objects.keys()
3887
    assert 'formdata-other-form-%d' % other_formdata.id not in session.visiting_objects.keys()
3888 3888
    session.visiting_objects = {}
3889 3889
    session.store()
3890 3890

  
......
5113 5113

  
5114 5114
    app = login(get_app(pub))
5115 5115
    resp = app.get(formdata.get_url(backoffice=True))
5116
    assert not 'Backoffice Data' in resp.text
5117
    assert not '1st backoffice field' in resp.text
5116
    assert 'Backoffice Data' not in resp.text
5117
    assert '1st backoffice field' not in resp.text
5118 5118

  
5119 5119
    formdata.data = {'bo1': 'HELLO WORLD'}
5120 5120
    formdata.store()
......
5396 5396
    workflow.store()
5397 5397

  
5398 5398
    resp = app.get(formdata.get_url(backoffice=True))
5399
    assert not 'message-to-all' in resp.text  # no actions no message
5399
    assert 'message-to-all' not in resp.text  # no actions no message
5400 5400

  
5401 5401
    again = ChoiceWorkflowStatusItem()
5402 5402
    again.id = '_again'
tests/form_pages/test_all.py
202 202
    resp = app.get('/')
203 203
    assert 'Status1' in resp
204 204
    assert '<a href="/test/%s/"' % formdata.id in resp
205
    assert not 'Draft' in resp
206
    assert not '<a href="test/%s"' % draft.id in resp
205
    assert 'Draft' not in resp
206
    assert '<a href="test/%s"' % draft.id not in resp
207 207
    resp = app.get('/test/%s/' % formdata.id)
208 208
    resp = app.get('/test/%s/' % draft.id, status=302)
209 209
    resp = resp.follow(status=403)
......
215 215
    formdef.store()
216 216
    home = get_app(pub).get('/')
217 217
    assert 'category-foobar' in home.text
218
    assert not 'category-misc' in home.text
218
    assert 'category-misc' not in home.text
219 219
    assert '<a class="" href="foobar/test/">test</a>' in home.text
220 220

  
221 221

  
......
242 242
    resp = get_app(pub).get('/')
243 243
    assert 'category-foobar' in resp.text  # 1st formdef
244 244
    assert 'category-barfoo' in resp.text  # 2nd formdef
245
    assert not 'category-misc' in resp.text  # no more "misc" category
245
    assert 'category-misc' not in resp.text  # no more "misc" category
246 246

  
247 247

  
248 248
def test_home_keywords(pub):
......
273 273
    formdef.disabled = True
274 274
    formdef.store()
275 275
    home = get_app(pub).get('/')
276
    assert not '<a href="test/">test</a>' in home.text
276
    assert '<a href="test/">test</a>' not in home.text
277 277

  
278 278
    # check access is denied
279 279
    get_app(pub).get('/test/', status=403)
......
496 496
    assert next_page.status_int == 302
497 497
    next_page = next_page.follow()
498 498
    assert 'The form has been recorded' in next_page.text
499
    assert not 'None' in next_page.text
499
    assert 'None' not in next_page.text
500 500
    assert formdef.data_class().count() == 1
501 501
    assert '<div class="section foldable folded" id="summary">' in next_page.text
502 502

  
......
729 729
    formdef.store()
730 730
    formdef.data_class().wipe()
731 731
    resp = get_app(pub).get('/test/')
732
    assert not '2nd page' in resp.text
733
    assert not '3rd page' in resp.text
732
    assert '2nd page' not in resp.text
733
    assert '3rd page' not in resp.text
734 734
    assert resp.forms[0]['f1'].value == 'Foo'  # preset
735 735
    resp = resp.forms[0].submit('submit')
736 736
    assert '2nd page' in resp.text
737
    assert not '3rd page' in resp.text
737
    assert '3rd page' not in resp.text
738 738
    assert_current_page(resp, '2nd page')
739 739

  
740 740
    resp = get_app(pub).get('/test/')
741 741
    resp.forms[0]['f1'] = 'Bar'
742 742
    resp = resp.forms[0].submit('submit')
743
    assert not '2nd page' in resp.text
743
    assert '2nd page' not in resp.text
744 744
    assert '3rd page' in resp.text
745 745
    assert_current_page(resp, '3rd page')
746 746

  
......
769 769
    formdef.store()
770 770
    formdef.data_class().wipe()
771 771
    resp = get_app(pub).get('/test/')
772
    assert not '2nd page' in resp.text
773
    assert not '3rd page' in resp.text
772
    assert '2nd page' not in resp.text
773
    assert '3rd page' not in resp.text
774 774
    resp.forms[0]['f1'] = 'Foo'
775 775
    resp = resp.forms[0].submit('submit')
776 776
    assert '2nd page' in resp.text
777
    assert not '3rd page' in resp.text
777
    assert '3rd page' not in resp.text
778 778
    assert_current_page(resp, '2nd page')
779 779

  
780 780
    resp = get_app(pub).get('/test/')
781 781
    resp.forms[0]['f1'] = 'Bar'
782 782
    resp = resp.forms[0].submit('submit')
783
    assert not '2nd page' in resp.text
783
    assert '2nd page' not in resp.text
784 784
    assert '3rd page' in resp.text
785 785
    assert_current_page(resp, '3rd page')
786 786

  
......
1153 1153
    resp = resp.form.submit('submit')  # -> page 3
1154 1154
    resp = resp.form.submit('submit')  # -> validation page
1155 1155
    assert 'Check values then click submit.' in resp.text
1156
    assert not 'bar' in resp.text
1156
    assert 'bar' not in resp.text
1157 1157
    resp = resp.form.submit('submit')
1158 1158
    assert formdef.data_class().count() == 1
1159 1159
    formdata = formdef.data_class().select()[0]
......
1428 1428
    formdef.data_class().wipe()
1429 1429

  
1430 1430
    resp = get_app(pub).get('/test/')
1431
    assert not '<h3 data-field-id="0">1st page/h3>' in resp.text
1431
    assert '<h3 data-field-id="0">1st page/h3>' not in resp.text
1432 1432
    assert '<h4 data-field-id="5">subtitle of 1st page</h4>' in resp.text
1433 1433
    resp.form['f1'] = 'foo'
1434 1434
    resp = resp.form.submit('submit')
......
1440 1440
    assert '<h3 data-field-id="6">title of second page</h3>' in resp.text
1441 1441
    resp = resp.form.submit('submit').follow()  # -> submit
1442 1442
    assert '<h3>1st page</h3>' in resp.text
1443
    assert not '<div class="title "><h3>1st page</h3></div>' in resp.text
1443
    assert '<div class="title "><h3>1st page</h3></div>' not in resp.text
1444 1444
    assert '<div class="subtitle "><h4>subtitle of 1st page</h4></div>' in resp.text
1445 1445
    assert '<div class="title "><h3>title of second page</h3></div>' in resp.text
1446 1446

  
......
1542 1542
    assert formdef.data_class().select()[0].data['1'] == 'plop1'
1543 1543
    assert formdef.data_class().select()[0].data['2'] == 'plop2'
1544 1544
    assert formdef.data_class().select()[0].data['3'] == 'plop3'
1545
    assert not 'plop1' in resp.text
1546
    assert not 'plop2' in resp.text
1545
    assert 'plop1' not in resp.text
1546
    assert 'plop2' not in resp.text
1547 1547
    assert 'plop3' in resp.text
1548 1548
    assert 'Bla bla bla' in resp.text
1549 1549

  
......
1565 1565
    resp = resp.form.submit('submit')  # -> validation
1566 1566

  
1567 1567
    pq = resp.pyquery.remove_namespaces()
1568
    assert not '<h3>1st page</h3>' in resp.text  # page 1 title not displayed
1568
    assert '<h3>1st page</h3>' not in resp.text  # page 1 title not displayed
1569 1569
    assert pq('div[style="display: none;"] [name=f1]')  # but page 1 field included, hidden
1570 1570
    assert '<h3>2nd page</h3>' in resp.text  # page 2 title
1571 1571
    assert 'Bla bla bla' in resp.text  # and page 2 comment field
......
1642 1642
    formdef.enable_tracking_codes = False
1643 1643
    formdef.store()
1644 1644
    resp = get_app(pub).get('/test/')
1645
    assert not '<h3>Tracking code</h3>' in resp.text
1645
    assert '<h3>Tracking code</h3>' not in resp.text
1646 1646

  
1647 1647

  
1648 1648
def test_form_no_tracking_code_variable(pub):
......
2004 2004
    # visit page, check there's no remove draft button
2005 2005
    resp = app.get('/test/')
2006 2006
    assert '<h3>Tracking code</h3>' in resp.text
2007
    assert not 'removedraft' in resp.text
2007
    assert 'removedraft' not in resp.text
2008 2008

  
2009 2009
    # check we can load the formdata as a draft
2010 2010
    resp = app.get('/')
......
3296 3296
    resp.form['f0'] = 'test'
3297 3297
    resp = resp.form.submit('submit')
3298 3298
    assert 'Check values then click submit.' in resp.text
3299
    assert not 'form_captcha' in resp.text
3299
    assert 'form_captcha' not in resp.text
3300 3300

  
3301 3301
    # check anonymous user gets the captcha
3302 3302
    app = get_app(pub)
......
3319 3319
    resp.form['f0'] = 'test'
3320 3320
    resp = resp.form.submit('submit')
3321 3321
    assert 'Check values then click submit.' in resp.text
3322
    assert not 'form_captcha' in resp.text
3322
    assert 'form_captcha' not in resp.text
3323 3323

  
3324 3324

  
3325 3325
def test_form_captcha_and_no_validation_page(pub):
......
3530 3530
        resp = app.get('/test/')
3531 3531
        resp.forms[0]['f0$file'] = upload
3532 3532
        resp = resp.forms[0].submit('submit')
3533
        assert not '<img alt="" src="tempfile?' in resp.text
3533
        assert '<img alt="" src="tempfile?' not in resp.text
3534 3534

  
3535 3535

  
3536 3536
def test_form_file_field_submit_document_type(pub):
......
3694 3694
    formdef.store()
3695 3695
    resp = get_app(pub).get('/test/')
3696 3696
    resp = resp.form.submit('submit')
3697
    assert not 'Check values then click submit.' in resp.text
3697
    assert 'Check values then click submit.' not in resp.text
3698 3698

  
3699 3699
    resp = get_app(pub).get('/test/')
3700 3700
    resp.form['f0$c-0-0'] = 'a'
......
3747 3747
    formdef.store()
3748 3748
    resp = get_app(pub).get('/test/')
3749 3749
    resp = resp.form.submit('submit')
3750
    assert not 'Check values then click submit.' in resp.text
3750
    assert 'Check values then click submit.' not in resp.text
3751 3751

  
3752 3752
    resp = get_app(pub).get('/test/')
3753 3753
    resp.form['f0$element0$col0'] = 'a'
......
3891 3891

  
3892 3892
    # check required field
3893 3893
    resp = resp.forms[0].submit('submit')
3894
    assert not 'Check values then click submit.' in resp.text
3894
    assert 'Check values then click submit.' not in resp.text
3895 3895
    assert 'data-geolocation="road"' in resp.text
3896 3896
    resp.forms[0]['f1'].value = 'bla'
3897 3897

  
......
4583 4583

  
4584 4584
    # not filled completed, no call to .autocomplete
4585 4585
    resp = get_app(pub).get('/test/')
4586
    assert not ').autocomplete({' in resp.text
4586
    assert ').autocomplete({' not in resp.text
4587 4587

  
4588 4588
    # straight URL
4589 4589
    formdef.fields[0].data_source = {'type': 'jsonp', 'value': 'http://example.org'}
......
5007 5007
    display1.condition = {'type': 'django', 'value': 'xxx'}
5008 5008
    workflow.store()
5009 5009
    page = app.get(formdata.get_url())
5010
    assert not 'message-to-all' in page.text
5010
    assert 'message-to-all' not in page.text
5011 5011

  
5012 5012

  
5013 5013
def test_session_cookie_flags(pub):
......
5037 5037

  
5038 5038
    resp = login(get_app(pub), username='foo', password='foo').get('/test/')
5039 5039
    assert resp.form['f0'].value == 'foo@localhost'
5040
    assert not 'readonly' in resp.form['f0'].attrs
5040
    assert 'readonly' not in resp.form['f0'].attrs
5041 5041
    resp.form['f0'].value = 'Hello'
5042 5042
    resp = resp.form.submit('submit')
5043 5043
    assert 'Check values then click submit.' in resp.text
......
5077 5077
        resp.form['f0'].value = 'Hello'  # try changing
5078 5078
        resp = resp.form.submit('previous')
5079 5079
        assert 'readonly' in resp.form['f0'].attrs
5080
        assert not 'Check values then click submit.' in resp.text
5080
        assert 'Check values then click submit.' not in resp.text
5081 5081
        assert resp.form['f0'].value == 'foo@localhost'
5082 5082

  
5083 5083
        # try it without validation page
......
5147 5147

  
5148 5148
    resp = login(get_app(pub), username='foo', password='foo').get('/test/')
5149 5149
    assert resp.form['f0'].value == '2018-09-27'
5150
    assert not 'readonly' in resp.form['f0'].attrs
5150
    assert 'readonly' not in resp.form['f0'].attrs
5151 5151
    resp.form['f0'].value = '2018-09-27'
5152 5152
    resp = resp.form.submit('submit')
5153 5153
    assert 'Check values then click submit.' in resp.text
......
5678 5678
        data = {'data': [{'id': '1', 'text': 'hello', 'disabled': True}, {'id': '2', 'text': 'world'}]}
5679 5679
        urlopen.side_effect = lambda *args: io.StringIO(json.dumps(data))
5680 5680
        resp = get_app(pub).get('/test/')
5681
        assert not 'f0$element1' in resp.form.fields
5681
        assert 'f0$element1' not in resp.form.fields
5682 5682
        resp.form['f0$element2'].checked = True
5683 5683
        resp = resp.form.submit('submit')  # -> validation page
5684 5684
        resp = resp.form.submit('submit')  # -> submit
......
6318 6318
    formdef.store()
6319 6319
    formdef.data_class().wipe()
6320 6320
    resp = get_app(pub).get('/test/')
6321
    assert not 'TEST TEMPLATE' in resp.text
6321
    assert 'TEST TEMPLATE' not in resp.text
6322 6322
    formdef.fields[0].extra_css_class = 'template-test'
6323 6323
    formdef.store()
6324 6324

  
......
6407 6407
    formdata = formdef.data_class().select()[0]
6408 6408

  
6409 6409
    resp = app.get(formdata.get_url())
6410
    assert not 'button-action-1' in resp.text
6410
    assert 'button-action-1' not in resp.text
6411 6411

  
6412 6412
    trigger.roles = ['_submitter']
6413 6413
    workflow.store()
......
6813 6813
    resp = get_app(pub).get('/foo/')
6814 6814
    resp.form['f1'] = 'hello'
6815 6815
    resp = resp.form.submit('submit')
6816
    assert not 'f4' in resp.form.fields
6816
    assert 'f4' not in resp.form.fields
6817 6817

  
6818 6818
    resp = get_app(pub).get('/foo/')
6819 6819
    resp.form['f1'] = 'éléphant'
......
6844 6844
    resp = get_app(pub).get('/foo/')
6845 6845
    resp.form['f1'] = 'hello'
6846 6846
    resp = resp.form.submit('submit')
6847
    assert not 'f4' in resp.form.fields
6847
    assert 'f4' not in resp.form.fields
6848 6848

  
6849 6849
    resp = get_app(pub).get('/foo/')
6850 6850
    resp.form['f1'] = 'éléphant'
......
6875 6875
    resp = get_app(pub).get('/foo/')
6876 6876
    resp.form['f1'] = 'hello'
6877 6877
    resp = resp.form.submit('submit')
6878
    assert not 'f4' in resp.form.fields
6878
    assert 'f4' not in resp.form.fields
6879 6879

  
6880 6880
    resp = get_app(pub).get('/foo/')
6881 6881
    resp.form['f1'] = 'éléphant'
......
6928 6928
    resp = get_app(pub).get('/foo/')
6929 6929
    resp.form['f1$element1'].checked = True
6930 6930
    resp = resp.form.submit('submit')
6931
    assert not 'f3' in resp.form.fields
6931
    assert 'f3' not in resp.form.fields
6932 6932

  
6933 6933
    resp = get_app(pub).get('/foo/')
6934 6934
    resp.form['f1$element1'].checked = True
......
7186 7186
    assert live_resp.json['result']['1']['visible']
7187 7187
    assert live_resp.json['result']['2']['visible']
7188 7188
    assert live_resp.json['result']['3']['visible']
7189
    assert not 'items' in live_resp.json['result']['3']
7189
    assert 'items' not in live_resp.json['result']['3']
7190 7190
    resp.form['f2'] = 'plop'
7191 7191
    live_resp = app.post('/foo/live?modified_field_id=2', params=resp.form.submit_fields())
7192 7192
    assert live_resp.json['result']['1']['visible']
......
7237 7237
    assert live_resp.json['result']['1']['visible']
7238 7238
    assert live_resp.json['result']['2']['visible']
7239 7239
    assert live_resp.json['result']['3']['visible']
7240
    assert not 'items' in live_resp.json['result']['3']
7240
    assert 'items' not in live_resp.json['result']['3']
7241 7241
    resp.form['f2'] = 'plop'
7242 7242
    live_resp = app.post('/foo/live?modified_field_id=2', params=resp.form.submit_fields())
7243 7243
    assert live_resp.json['result']['1']['visible']
......
7324 7324
    assert live_resp.json['result']['xxx_1']['visible']
7325 7325
    assert live_resp.json['result']['xxx_2']['visible']
7326 7326
    assert live_resp.json['result']['xxx_3']['visible']
7327
    assert not 'items' in live_resp.json['result']['xxx_3']
7327
    assert 'items' not in live_resp.json['result']['xxx_3']
7328 7328
    resp.form['fxxx_2'] = 'plop'
7329 7329
    live_resp = app.post('/test/1/live?modified_field_id=xxx_2', params=resp.form.submit_fields())
7330 7330
    assert live_resp.json['result']['xxx_1']['visible']
......
7968 7968

  
7969 7969
    app = login(get_app(pub), username='foo', password='foo')
7970 7970
    resp = app.get('/test/')
7971
    assert not 'You already started to fill this form.' in resp.text
7971
    assert 'You already started to fill this form.' not in resp.text
7972 7972

  
7973 7973
    draft = formdef.data_class()()
7974 7974
    draft.user_id = user.id
tests/test_hobo.py
334 334
    HOBO_JSON['profile']['fields'][8]['disabled'] = True
335 335
    hobo_cmd.update_profile(profile, pub)
336 336
    formdef = UserFieldsFormDef(pub)
337
    assert not '_mobile' in [x.id for x in formdef.fields]
337
    assert '_mobile' not in [x.id for x in formdef.fields]
338 338

  
339 339
    # add a custom local field
340 340
    formdef = UserFieldsFormDef(pub)
......
353 353
        attribute_name = str(field['name'])
354 354
        field_id = str('_' + attribute_name)
355 355
        if field.get('disabled'):
356
            assert not attribute_name in attribute_mapping
356
            assert attribute_name not in attribute_mapping
357 357
        else:
358 358
            assert attribute_mapping[attribute_name] == field_id
359 359

  
tests/test_misc.py
603 603
    assert emails.emails['test']['msg'].get_payload()[1].get_content_type() == 'text/html'
604 604
    html = emails.emails['test']['msg'].get_payload()[1].get_payload(decode=True)
605 605
    assert html.count(b'<ol') == 1
606
    assert not b'<ul' in html
606
    assert b'<ul' not in html
607 607
    assert b'arabic simple' in html
608 608
    assert b'M. Francis Kuntz' in html
609 609

  
tests/test_publisher.py
156 156
    os.mkdir(os.path.join(pub.APP_DIR, 'plop.invalid'))
157 157
    tenants = list(pub.__class__.get_tenants())
158 158
    assert 'example.net' in tenants
159
    assert not 'xxx' in tenants
160
    assert not 'plop.invalid' in tenants
159
    assert 'xxx' not in tenants
160
    assert 'plop.invalid' not in tenants
161 161

  
162 162

  
163 163
def test_register_cronjobs():
tests/test_sql.py
1138 1138
    union = ' UNION '.join(
1139 1139
        ['''SELECT %s FROM %s''' % (', '.join([y[1] for y in common_fields]), x) for x in view_names]
1140 1140
    )
1141
    assert not 'formdef_id' in union
1141
    assert 'formdef_id' not in union
1142 1142
    cur.execute('''CREATE VIEW wcs_all_forms AS %s''' % union)
1143 1143

  
1144 1144
    sql.migrate()
tests/test_widgets.py
186 186
    for row in range(10):
187 187
        for col in range(3):
188 188
            assert 'test$element%d$col%d' % (row, col) in form.as_html
189
    assert not 'test$element%d$col%d' % (10, 0) in form.as_html
189
    assert 'test$element%d$col%d' % (10, 0) not in form.as_html
190 190

  
191 191
    mock_form_submission(req, widget, click='test$add_element')
192 192
    widget = TableListRowsWidget('test', columns=['a', 'b', 'c'])
......
1128 1128
    assert widget.parse() == '1.23;2.34'
1129 1129

  
1130 1130
    assert '<label' in str(widget.render())
1131
    assert not '<label ' in str(widget.render_widget_content())
1131
    assert '<label ' not in str(widget.render_widget_content())
1132 1132

  
1133 1133
    pub.load_site_options()
1134 1134
    pub.site_options.set('options', 'map-bounds-top-left', '1.23;2.34')
tests/test_wscall.py
51 51
    wscall.slug = 'bye'
52 52
    wscall.store()
53 53
    assert 'bye' in NamedWsCall.keys()
54
    assert not 'hello_1' in NamedWsCall.keys()
54
    assert 'hello_1' not in NamedWsCall.keys()
55 55

  
56 56

  
57 57
def test_webservice_substitution_variable(http_requests, pub):
......
77 77
        wscall.call()
78 78
    except Exception:
79 79
        pass
80
    assert not 'signature=' in http_requests.get_last('url')
80
    assert 'signature=' not in http_requests.get_last('url')
81 81

  
82 82
    wscall.request = {'url': 'http://idp.example.net'}
83 83
    try:
......
101 101
        wscall.call()
102 102
    except Exception:
103 103
        pass
104
    assert not 'orig=example.net' in http_requests.get_last('url')
104
    assert 'orig=example.net' not in http_requests.get_last('url')
105 105
    assert 'signature=' in http_requests.get_last('url')
106 106

  
107 107

  
108
-