misc: pylint fix unneeded-not (#52630)

This commit is contained in:
Lauréline Guérin 2021-04-02 14:14:55 +02:00
parent 37e8d1adba
commit 5253275e37
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
9 changed files with 123 additions and 123 deletions

View File

@ -111,7 +111,7 @@ def test_forms_new_popup(pub):
def assert_option_display(resp, label, value):
option_line = re.findall('%s.*%s' % (label, value), resp.text, re.DOTALL)
assert option_line
assert not '</li>' in option_line
assert '</li>' not in option_line
def test_forms_edit(pub):
@ -281,7 +281,7 @@ def test_form_title_change(pub):
resp = resp.click('change title')
assert resp.form['name'].value == 'form title'
assert 'data-slug-sync' in resp.text
assert not 'change-nevertheless' in resp.text
assert 'change-nevertheless' not in resp.text
resp.form['name'] = 'new title'
resp = resp.form.submit()
assert resp.location == 'http://example.net/backoffice/forms/1/'
@ -293,8 +293,8 @@ def test_form_title_change(pub):
resp = app.get('/backoffice/forms/1/')
resp = resp.click('change title')
assert not 'data-slug-sync' in resp.text
assert not 'change-nevertheless' in resp.text
assert 'data-slug-sync' not in resp.text
assert 'change-nevertheless' not in resp.text
formdef.data_class()().store()
resp = app.get('/backoffice/forms/1/')
@ -573,7 +573,7 @@ def test_form_submitter_roles(pub):
resp = app.get('/backoffice/forms/1/')
resp = resp.click(href=re.compile('^roles$'))
resp.form['roles$element0'] = 'logged-users'
assert not 'required_authentication_contexts' in resp.text
assert 'required_authentication_contexts' not in resp.text
resp = resp.form.submit()
assert FormDef.get(formdef.id).roles == ['logged-users']

View File

@ -255,7 +255,7 @@ def test_backoffice_forms(pub):
resp = app.get('/backoffice/')
resp = resp.click('Management', index=0)
resp = resp.follow()
assert not 'Forms in your care' in resp.text
assert 'Forms in your care' not in resp.text
assert re.findall('Other Forms.*form-title', resp.text)
# 2nd time with user set as receiver of the forms
@ -582,7 +582,7 @@ def test_backoffice_columns(pub):
resp = app.get('/backoffice/management/form-title/')
assert resp.text.count('</th>') == 8 # six columns
resp.forms['listing-settings']['1'].checked = False
assert not 'submission_channel' in resp.forms['listing-settings'].fields
assert 'submission_channel' not in resp.forms['listing-settings'].fields
assert 'last_update_time' in resp.forms['listing-settings'].fields
resp = resp.forms['listing-settings'].submit()
assert resp.text.count('</th>') == 7 # fixe columns
@ -630,7 +630,7 @@ def test_backoffice_submission_agent_column(pub):
app = login(get_app(pub))
resp = app.get('/backoffice/management/form-title/')
assert not 'submission_agent' in resp.forms['listing-settings'].fields
assert 'submission_agent' not in resp.forms['listing-settings'].fields
formdef = FormDef.get_by_urlname('form-title')
formdef.backoffice_submission_roles = user.roles
@ -641,10 +641,10 @@ def test_backoffice_submission_agent_column(pub):
resp = resp.forms['listing-settings'].submit()
assert resp.text.count('</th>') == 9 # seven columns
assert resp.text.count('data-link') == 17 # 17 rows
assert not '>agent<' in resp.text
assert '>agent<' not in resp.text
resp = resp.click('Export as CSV File')
assert len(resp.text.splitlines()) == 18 # 17 + header line
assert not ',agent,' in resp.text
assert ',agent,' not in resp.text
for formdata in formdef.data_class().select():
formdata.submission_agent_id = str(agent.id)
@ -877,7 +877,7 @@ def test_backoffice_default_filter(pub):
create_environment(pub)
app = login(get_app(pub))
resp = app.get('/backoffice/management/form-title/')
assert not 'filter-2-value' in resp.forms['listing-settings'].fields
assert 'filter-2-value' not in resp.forms['listing-settings'].fields
formdef = FormDef.get_by_urlname('form-title')
formdef.fields[1].in_filters = True
@ -891,7 +891,7 @@ def test_backoffice_default_filter(pub):
)
formdef.store()
resp = app.get('/backoffice/management/form-title/')
assert not 'filter-4-value' in resp.forms['listing-settings'].fields
assert 'filter-4-value' not in resp.forms['listing-settings'].fields
formdef.fields[-1].in_filters = True
formdef.store()
@ -1489,7 +1489,7 @@ def test_backoffice_statistics(pub):
assert 'Resolution time' in resp.text
assert 'To Status &quot;New&quot;' in resp.text
assert 'To Status &quot;Finished&quot;' in resp.text
assert not '<h2>Filters</h2>' in resp.text
assert '<h2>Filters</h2>' not in resp.text
resp.forms['listing-settings']['filter-end-value'] = '2013-01-01'
resp = resp.forms['listing-settings'].submit()
@ -1564,7 +1564,7 @@ def test_backoffice_multi_actions(pub):
workflow.store()
resp = app.get('/backoffice/management/form-title/')
assert 'id="multi-actions"' in resp.text
assert not 'OTHER ACTION' in resp.text
assert 'OTHER ACTION' not in resp.text
# action for function
trigger.roles = ['_foobar']
@ -1772,13 +1772,13 @@ def test_backoffice_statistics_status_filter(pub):
resp = app.get('/backoffice/management/form-title/')
resp = resp.click('Statistics')
assert 'filter' not in resp.forms['listing-settings'].fields # status is not displayed by default
assert not '<h2>Filters</h2>' in resp.text
assert '<h2>Filters</h2>' not in resp.text
# add 'status' as a filter
resp.forms['listing-settings']['filter-status'].checked = True
resp = resp.forms['listing-settings'].submit()
assert 'filter' in resp.forms['listing-settings'].fields
assert not '<h2>Filters</h2>' in resp.text
assert '<h2>Filters</h2>' not in resp.text
assert resp.forms['listing-settings']['filter'].value == 'all'
resp.forms['listing-settings']['filter'].value = 'pending'
@ -1810,7 +1810,7 @@ def test_backoffice_statistics_status_select(pub):
app = login(get_app(pub))
resp = app.get('/backoffice/management/form-title/')
resp = resp.click('Statistics')
assert not 'filter-2-value' in resp.form.fields
assert 'filter-2-value' not in resp.form.fields
resp.forms['listing-settings']['filter-2'].checked = True
resp = resp.forms['listing-settings'].submit()
@ -1863,7 +1863,7 @@ def test_backoffice_map(pub):
assert re.findall('<tbody.*\/tbody>', resp.text, re.DOTALL)[0].count('<tr') == 17
# check there's no link to map the sidebar
assert not 'Plot on a Map' in resp.text
assert 'Plot on a Map' not in resp.text
formdef = FormDef.get_by_urlname('form-title')
formdef.geolocations = {'base': 'Geolocafoobar'}
@ -2037,7 +2037,7 @@ def test_backoffice_submission_context(pub):
assert (' with the number %s.' % number31.get_display_id()) in resp.text
# check there's nothing in the sidebar
assert not 'Channel' in resp.text
assert 'Channel' not in resp.text
number31.submission_channel = 'mail'
number31.user_id = user.id
@ -2137,7 +2137,7 @@ def test_backoffice_geolocation_info(pub):
assert (' with the number %s.' % number31.get_display_id()) in resp.text
# check there's nothing in the sidebar
assert not 'Geolocation' in resp.text
assert 'Geolocation' not in resp.text
number31.geolocations = {'base': {'lat': 48.83, 'lon': 2.32}}
number31.store()
@ -2185,8 +2185,8 @@ def test_backoffice_info_text(pub):
resp = app.get('/backoffice/management/form-title/%s/' % number31.id)
assert (' with the number %s.' % number31.get_display_id()) in resp.text
assert 'CLICK ME!' in resp.text
assert not 'CLICK ME2!' in resp.text
assert not 'backoffice-description' in resp.text
assert 'CLICK ME2!' not in resp.text
assert 'backoffice-description' not in resp.text
# add an info text to the status
st1.backoffice_info_text = '<p>Foo</p>'
@ -2214,16 +2214,16 @@ def test_backoffice_info_text(pub):
app2 = login(get_app(pub), username='foobar', password='foobar')
resp = app2.get('/backoffice/management/form-title/%s/' % number31.id)
assert 'Be warned forms of this user are also being looked' in resp.text
assert not 'backoffice-description' in resp.text
assert not 'CLICK ME!' in resp.text
assert not 'CLICK ME2!' in resp.text
assert 'backoffice-description' not in resp.text
assert 'CLICK ME!' not in resp.text
assert 'CLICK ME2!' not in resp.text
# remove info text from the status
st1.backoffice_info_text = None
workflow.store()
resp = app.get('/backoffice/management/form-title/%s/' % number31.id)
assert 'backoffice-description' in resp.text
assert not '<p>Foo</p>' in resp.text
assert '<p>Foo</p>' not in resp.text
assert '<p>Bar</p>' in resp.text
# add info text to second button
@ -2231,15 +2231,15 @@ def test_backoffice_info_text(pub):
workflow.store()
resp = app.get('/backoffice/management/form-title/%s/' % number31.id)
assert 'backoffice-description' in resp.text
assert not '<p>Foo</p>' in resp.text
assert '<p>Foo</p>' not in resp.text
assert '<p>Bar</p>' in resp.text
assert not '<p>Baz</p>' in resp.text
assert '<p>Baz</p>' not in resp.text
# remove info text from first button
commentable.backoffice_info_text = None
workflow.store()
resp = app.get('/backoffice/management/form-title/%s/' % number31.id)
assert not 'backoffice-description' in resp.text
assert 'backoffice-description' not in resp.text
def test_backoffice_handling_post_dispatch(pub):
@ -2257,7 +2257,7 @@ def test_backoffice_handling_post_dispatch(pub):
# check there's no access at the moment
resp = app.get('/backoffice/management/').follow()
assert not 'form-title/' in resp.text
assert 'form-title/' not in resp.text
resp = app.get('/backoffice/management/form-title/', status=403)
resp = app.get('/backoffice/management/form-title/%s/' % number31.id, status=403)
@ -2354,7 +2354,7 @@ def test_backoffice_wscall_failure_display(http_requests, pub):
# the failure message shouldn't be displayed in the frontoffice
resp = app.get('/form-title/%s/' % number31.id)
assert (' with the number %s.' % number31.get_display_id()) in resp.text
assert not 'Error during webservice call' in resp.text
assert 'Error during webservice call' not in resp.text
@pytest.mark.parametrize('notify_on_errors', [True, False])
@ -2537,7 +2537,7 @@ def test_backoffice_wfedit(pub):
resp = resp.form.submit('button_wfedit')
resp = resp.follow()
assert 'http://www.example.com/test.pdf' in resp.text # make sure sidebar has details
assert not 'Tracking Code' in resp.text # make sure it doesn't display a tracking code
assert 'Tracking Code' not in resp.text # make sure it doesn't display a tracking code
assert resp.form['f1'].value == number31.data['1']
assert resp.form['f2'].value == number31.data['2']
assert resp.form['f3'].value == number31.data['3']
@ -2960,7 +2960,7 @@ def test_global_listing(pub):
assert 'Global View' in resp.text
resp = resp.click('Global View')
assert resp.text[resp.text.index('<tbody') :].count('<tr') == 20
assert not 'Map View' in resp.text
assert 'Map View' not in resp.text
resp = app.get('/backoffice/management/listing?limit=500')
assert resp.text[resp.text.index('<tbody') :].count('<tr') == 37 # 17 formdef1 + 20 formdef2
@ -2979,7 +2979,7 @@ def test_global_listing(pub):
assert resp.text[resp.text.index('<tbody') :].count('<tr') == 20
assert 'http://example.net/backoffice/management/other-form/' in resp.text
assert not 'http://example.net/backoffice/management/form-title/' in resp.text
assert 'http://example.net/backoffice/management/form-title/' not in resp.text
formdef = FormDef.get_by_urlname('form-title')
last_update_time = formdef.data_class().select(lambda x: not x.is_draft())[0].last_update_time
@ -2999,7 +2999,7 @@ def test_global_listing(pub):
assert 'digest of number &lt;%s&gt;' % formdata.id_display in resp.text
# check a Channel column is added when welco is available
assert not 'Channel' in resp.text
assert 'Channel' not in resp.text
if not pub.site_options.has_section('variables'):
pub.site_options.add_section('variables')
@ -3053,19 +3053,19 @@ def test_global_listing(pub):
resp.forms['listing-settings']['status'] = 'waiting'
resp = resp.forms['listing-settings'].submit()
assert resp.text[resp.text.index('<tbody') :].count('<tr') == 20
assert not 'form-title' in resp.text
assert 'form-title' not in resp.text
resp.forms['listing-settings']['status'] = 'open'
resp = resp.forms['listing-settings'].submit()
assert resp.text[resp.text.index('<tbody') :].count('<tr') == 20
assert not 'form-title' in resp.text
assert 'form-title' not in resp.text
resp.forms['listing-settings']['status'] = 'all'
resp = resp.forms['listing-settings'].submit()
assert resp.text[resp.text.index('<tbody') :].count('<tr') == 20
assert not 'form-title' in resp.text
assert 'form-title' not in resp.text
resp.forms['listing-settings']['status'] = 'done'
resp = resp.forms['listing-settings'].submit()
assert resp.text[resp.text.index('<tbody') :].count('<tr') == 0
assert not 'form-title' in resp.text
assert 'form-title' not in resp.text
def test_global_listing_parameters_from_query_string(pub):
@ -3166,7 +3166,7 @@ def test_category_in_global_listing(pub):
app = login(get_app(pub))
resp = app.get('/backoffice/management/listing?limit=500')
assert not 'category_id' in resp.forms['listing-settings'].fields
assert 'category_id' not in resp.forms['listing-settings'].fields
cat1 = Category(name='cat1')
cat1.store()
@ -3187,13 +3187,13 @@ def test_category_in_global_listing(pub):
resp.forms['listing-settings']['category_id'] = cat1.id
resp = resp.forms['listing-settings'].submit()
assert not 'management/other-form/' in resp.text
assert 'management/other-form/' not in resp.text
assert 'management/form-title/' in resp.text
resp.forms['listing-settings']['category_id'] = cat2.id
resp = resp.forms['listing-settings'].submit()
assert 'management/other-form/' in resp.text
assert not 'management/form-title/' in resp.text
assert 'management/form-title/' not in resp.text
def test_datetime_in_global_listing(pub):
@ -3406,7 +3406,7 @@ def test_backoffice_sidebar_user_context(pub):
assert (' with the number %s.' % number31.get_display_id()) in resp.text
# check there's nothing in the sidebar
assert not '/user-pending-forms' in resp.text
assert '/user-pending-forms' not in resp.text
number31.formdef.digest_template = 'digest of number {{form_number}}'
number31.user_id = user.id
@ -3415,7 +3415,7 @@ def test_backoffice_sidebar_user_context(pub):
assert '/user-pending-forms' in resp.text
user_pending_form_url = re.findall('data-async-url="(.*/user-pending-forms)"', resp.text)[0]
partial_resp = app.get(user_pending_form_url)
assert not number31.get_url(backoffice=True) in partial_resp.text
assert number31.get_url(backoffice=True) not in partial_resp.text
assert number31.digest in partial_resp.text
assert '<span class="formname">%s</span>' % number31.formdef.name in partial_resp.text
@ -3428,7 +3428,7 @@ def test_backoffice_sidebar_user_context(pub):
assert '/user-pending-forms' in resp.text
user_pending_form_url = re.findall('data-async-url="(.*/user-pending-forms)"', resp.text)[0]
partial_resp = app.get(user_pending_form_url)
assert not number31.get_url(backoffice=True) in partial_resp.text
assert number31.get_url(backoffice=True) not in partial_resp.text
assert number34.get_url(backoffice=True) in partial_resp.text
cat1 = Category(name='cat1')
@ -3639,7 +3639,7 @@ def test_per_user_view(pub):
resp = app.get('/backoffice/management/users/%s/' % user.id)
for item in to_match:
assert not item in resp.text # not linked
assert item not in resp.text # not linked
assert resp.text.count('<li') == count_li
# mark formdef so it's not listed in per-user view
@ -3667,7 +3667,7 @@ def test_per_user_view_tracking_code(pub, emails, sms_mocking):
number31.store()
resp = app.get('/backoffice/management/users/%s/' % user.id)
assert not 'Send tracking code' in resp.text
assert 'Send tracking code' not in resp.text
formdef.enable_tracking_codes = True
formdef.store()
@ -3677,7 +3677,7 @@ def test_per_user_view_tracking_code(pub, emails, sms_mocking):
pub.cfg['sms'] = {}
pub.write_cfg()
resp = user_view_resp.click('Send tracking code')
assert not 'sms' in resp.form.fields
assert 'sms' not in resp.form.fields
assert resp.form['email'].value == user.email
resp = resp.form.submit()
@ -3720,7 +3720,7 @@ def test_backoffice_backoffice_submission_in_listings(pub):
app = login(get_app(pub))
resp = app.get('/backoffice/management/form-title/')
first_link = re.findall('data-link="(\d+)/?"', resp.text)[0]
assert not 'backoffice-submission' in resp.text
assert 'backoffice-submission' not in resp.text
formdata = FormDef.get_by_urlname('form-title').data_class().get(first_link)
formdata.backoffice_submission = True
@ -3739,7 +3739,7 @@ def test_backoffice_backoffice_submission_in_global_listing(pub):
app = login(get_app(pub))
resp = app.get('/backoffice/management/listing?limit=100')
assert not 'backoffice-submission' in resp.text
assert 'backoffice-submission' not in resp.text
formdef = FormDef.get_by_urlname('form-title')
formdata = formdef.data_class().get(
@ -3767,59 +3767,59 @@ def test_backoffice_advisory_lock(pub):
app = login(get_app(pub))
resp = app.get('/backoffice/management/form-title/')
first_link = re.findall('data-link="(\d+/)?"', resp.text)[0]
assert not 'advisory-lock' in resp.text
assert 'advisory-lock' not in resp.text
app2 = login(get_app(pub), username='foobar', password='foobar')
resp = app2.get('/backoffice/management/form-title/')
assert not 'advisory-lock' in resp.text
assert 'advisory-lock' not in resp.text
resp = app.get('/backoffice/management/form-title/' + first_link)
resp = app2.get('/backoffice/management/form-title/')
assert 'advisory-lock' in resp.text
resp = app.get('/backoffice/management/form-title/')
assert not 'advisory-lock' in resp.text
assert 'advisory-lock' not in resp.text
if pub.is_using_postgresql():
# check global view
resp = app2.get('/backoffice/management/listing?limit=100')
assert 'advisory-lock' in resp.text
resp = app.get('/backoffice/management/listing?limit=100')
assert not 'advisory-lock' in resp.text
assert 'advisory-lock' not in resp.text
resp = app.get('/backoffice/management/form-title/' + first_link)
assert not 'Be warned forms of this user are also being looked' in resp.text
assert 'Be warned forms of this user are also being looked' not in resp.text
assert 'button_commentable' in resp.text
assert len(resp.forms)
resp = app2.get('/backoffice/management/form-title/' + first_link)
assert 'Be warned forms of this user are also being looked' in resp.text
assert not 'button_commentable' in resp.text
assert 'button_commentable' not in resp.text
assert len(resp.forms) == 0
# revisit with first user, no change
resp = app.get('/backoffice/management/form-title/' + first_link)
assert not 'Be warned forms of this user are also being looked' in resp.text
assert 'Be warned forms of this user are also being looked' not in resp.text
assert 'button_commentable' in resp.text
# back to second
resp = app2.get('/backoffice/management/form-title/' + first_link)
assert 'Be warned forms of this user are also being looked' in resp.text
assert not 'button_commentable' in resp.text
assert 'button_commentable' not in resp.text
resp = resp.click('(unlock actions)')
resp = resp.follow()
assert 'Be warned forms of this user are also being looked' in resp.text
assert 'button_commentable' in resp.text
assert not '(unlock actions)' in resp.text
assert '(unlock actions)' not in resp.text
assert len(resp.forms)
# submit action form
resp.form['comment'] = 'HELLO'
resp = resp.form.submit('button_commentable')
# locks are reset after an action
assert not 'advisory-lock' in app2.get('/backoffice/management/form-title/')
assert not 'advisory-lock' in app.get('/backoffice/management/form-title/')
assert 'advisory-lock' not in app2.get('/backoffice/management/form-title/')
assert 'advisory-lock' not in app.get('/backoffice/management/form-title/')
# but as the current user is redirected to the form, a lock will be
# acquired (unless the user didn't have actions anymore, but it's not the
# case here)
resp = resp.follow()
assert not 'advisory-lock' in app2.get('/backoffice/management/form-title/')
assert 'advisory-lock' not in app2.get('/backoffice/management/form-title/')
assert 'advisory-lock' in app.get('/backoffice/management/form-title/')
@ -3858,7 +3858,7 @@ def test_backoffice_advisory_lock_related_formdatas(pub):
app = login(get_app(pub))
resp = app.get('/backoffice/management/form-title/%s/' % formdatas[0].id)
assert not 'Be warned forms of this user are also being looked' in resp.text
assert 'Be warned forms of this user are also being looked' not in resp.text
app.get(re.findall('data-async-url="(.*/user-pending-forms)"', resp.text)[0])
app2 = login(get_app(pub), username='foobar', password='foobar')
@ -3873,7 +3873,7 @@ def test_backoffice_advisory_lock_related_formdatas(pub):
# another by another user
resp2 = app2.get('/backoffice/management/form-title/%s/' % formdatas[3].id)
assert not 'Be warned forms of this user are also being looked' in resp2.text
assert 'Be warned forms of this user are also being looked' not in resp2.text
app2.get(re.findall('data-async-url="(.*/user-pending-forms)"', resp.text)[0])
# check another formdef is only marked as visited if the user has potential
@ -3884,7 +3884,7 @@ def test_backoffice_advisory_lock_related_formdatas(pub):
other_formdata = second_formdef.data_class().get(other_formdatas[0].id)
other_formdata.store() # update concerned_roles
assert not 'formdata-other-form-%d' % other_formdata.id in session.visiting_objects.keys()
assert 'formdata-other-form-%d' % other_formdata.id not in session.visiting_objects.keys()
session.visiting_objects = {}
session.store()
@ -5113,8 +5113,8 @@ def test_backoffice_fields(pub):
app = login(get_app(pub))
resp = app.get(formdata.get_url(backoffice=True))
assert not 'Backoffice Data' in resp.text
assert not '1st backoffice field' in resp.text
assert 'Backoffice Data' not in resp.text
assert '1st backoffice field' not in resp.text
formdata.data = {'bo1': 'HELLO WORLD'}
formdata.store()
@ -5396,7 +5396,7 @@ def test_backoffice_display_message(pub):
workflow.store()
resp = app.get(formdata.get_url(backoffice=True))
assert not 'message-to-all' in resp.text # no actions no message
assert 'message-to-all' not in resp.text # no actions no message
again = ChoiceWorkflowStatusItem()
again.id = '_again'

View File

@ -202,8 +202,8 @@ def test_home_with_user_forms(pub):
resp = app.get('/')
assert 'Status1' in resp
assert '<a href="/test/%s/"' % formdata.id in resp
assert not 'Draft' in resp
assert not '<a href="test/%s"' % draft.id in resp
assert 'Draft' not in resp
assert '<a href="test/%s"' % draft.id not in resp
resp = app.get('/test/%s/' % formdata.id)
resp = app.get('/test/%s/' % draft.id, status=302)
resp = resp.follow(status=403)
@ -215,7 +215,7 @@ def test_home_category(pub):
formdef.store()
home = get_app(pub).get('/')
assert 'category-foobar' in home.text
assert not 'category-misc' in home.text
assert 'category-misc' not in home.text
assert '<a class="" href="foobar/test/">test</a>' in home.text
@ -242,7 +242,7 @@ def test_home_two_categories(pub):
resp = get_app(pub).get('/')
assert 'category-foobar' in resp.text # 1st formdef
assert 'category-barfoo' in resp.text # 2nd formdef
assert not 'category-misc' in resp.text # no more "misc" category
assert 'category-misc' not in resp.text # no more "misc" category
def test_home_keywords(pub):
@ -273,7 +273,7 @@ def test_home_disabled(pub):
formdef.disabled = True
formdef.store()
home = get_app(pub).get('/')
assert not '<a href="test/">test</a>' in home.text
assert '<a href="test/">test</a>' not in home.text
# check access is denied
get_app(pub).get('/test/', status=403)
@ -496,7 +496,7 @@ def test_form_submit(pub):
assert next_page.status_int == 302
next_page = next_page.follow()
assert 'The form has been recorded' in next_page.text
assert not 'None' in next_page.text
assert 'None' not in next_page.text
assert formdef.data_class().count() == 1
assert '<div class="section foldable folded" id="summary">' in next_page.text
@ -729,18 +729,18 @@ def test_form_multi_page_condition_select(pub):
formdef.store()
formdef.data_class().wipe()
resp = get_app(pub).get('/test/')
assert not '2nd page' in resp.text
assert not '3rd page' in resp.text
assert '2nd page' not in resp.text
assert '3rd page' not in resp.text
assert resp.forms[0]['f1'].value == 'Foo' # preset
resp = resp.forms[0].submit('submit')
assert '2nd page' in resp.text
assert not '3rd page' in resp.text
assert '3rd page' not in resp.text
assert_current_page(resp, '2nd page')
resp = get_app(pub).get('/test/')
resp.forms[0]['f1'] = 'Bar'
resp = resp.forms[0].submit('submit')
assert not '2nd page' in resp.text
assert '2nd page' not in resp.text
assert '3rd page' in resp.text
assert_current_page(resp, '3rd page')
@ -769,18 +769,18 @@ def test_form_multi_page_condition_select_new_varname(pub):
formdef.store()
formdef.data_class().wipe()
resp = get_app(pub).get('/test/')
assert not '2nd page' in resp.text
assert not '3rd page' in resp.text
assert '2nd page' not in resp.text
assert '3rd page' not in resp.text
resp.forms[0]['f1'] = 'Foo'
resp = resp.forms[0].submit('submit')
assert '2nd page' in resp.text
assert not '3rd page' in resp.text
assert '3rd page' not in resp.text
assert_current_page(resp, '2nd page')
resp = get_app(pub).get('/test/')
resp.forms[0]['f1'] = 'Bar'
resp = resp.forms[0].submit('submit')
assert not '2nd page' in resp.text
assert '2nd page' not in resp.text
assert '3rd page' in resp.text
assert_current_page(resp, '3rd page')
@ -1153,7 +1153,7 @@ def test_form_multi_page_condition_stored_values(pub):
resp = resp.form.submit('submit') # -> page 3
resp = resp.form.submit('submit') # -> validation page
assert 'Check values then click submit.' in resp.text
assert not 'bar' in resp.text
assert 'bar' not in resp.text
resp = resp.form.submit('submit')
assert formdef.data_class().count() == 1
formdata = formdef.data_class().select()[0]
@ -1428,7 +1428,7 @@ def test_form_titles(pub):
formdef.data_class().wipe()
resp = get_app(pub).get('/test/')
assert not '<h3 data-field-id="0">1st page/h3>' in resp.text
assert '<h3 data-field-id="0">1st page/h3>' not in resp.text
assert '<h4 data-field-id="5">subtitle of 1st page</h4>' in resp.text
resp.form['f1'] = 'foo'
resp = resp.form.submit('submit')
@ -1440,7 +1440,7 @@ def test_form_titles(pub):
assert '<h3 data-field-id="6">title of second page</h3>' in resp.text
resp = resp.form.submit('submit').follow() # -> submit
assert '<h3>1st page</h3>' in resp.text
assert not '<div class="title "><h3>1st page</h3></div>' in resp.text
assert '<div class="title "><h3>1st page</h3></div>' not in resp.text
assert '<div class="subtitle "><h4>subtitle of 1st page</h4></div>' in resp.text
assert '<div class="title "><h3>title of second page</h3></div>' in resp.text
@ -1542,8 +1542,8 @@ def test_form_display_locations(pub):
assert formdef.data_class().select()[0].data['1'] == 'plop1'
assert formdef.data_class().select()[0].data['2'] == 'plop2'
assert formdef.data_class().select()[0].data['3'] == 'plop3'
assert not 'plop1' in resp.text
assert not 'plop2' in resp.text
assert 'plop1' not in resp.text
assert 'plop2' not in resp.text
assert 'plop3' in resp.text
assert 'Bla bla bla' in resp.text
@ -1565,7 +1565,7 @@ def test_multipage_form_display_locations(pub):
resp = resp.form.submit('submit') # -> validation
pq = resp.pyquery.remove_namespaces()
assert not '<h3>1st page</h3>' in resp.text # page 1 title not displayed
assert '<h3>1st page</h3>' not in resp.text # page 1 title not displayed
assert pq('div[style="display: none;"] [name=f1]') # but page 1 field included, hidden
assert '<h3>2nd page</h3>' in resp.text # page 2 title
assert 'Bla bla bla' in resp.text # and page 2 comment field
@ -1642,7 +1642,7 @@ def test_form_no_tracking_code(pub):
formdef.enable_tracking_codes = False
formdef.store()
resp = get_app(pub).get('/test/')
assert not '<h3>Tracking code</h3>' in resp.text
assert '<h3>Tracking code</h3>' not in resp.text
def test_form_no_tracking_code_variable(pub):
@ -2004,7 +2004,7 @@ def test_form_tracking_code_remove_draft(pub, nocache):
# visit page, check there's no remove draft button
resp = app.get('/test/')
assert '<h3>Tracking code</h3>' in resp.text
assert not 'removedraft' in resp.text
assert 'removedraft' not in resp.text
# check we can load the formdata as a draft
resp = app.get('/')
@ -3296,7 +3296,7 @@ def test_form_captcha(pub):
resp.form['f0'] = 'test'
resp = resp.form.submit('submit')
assert 'Check values then click submit.' in resp.text
assert not 'form_captcha' in resp.text
assert 'form_captcha' not in resp.text
# check anonymous user gets the captcha
app = get_app(pub)
@ -3319,7 +3319,7 @@ def test_form_captcha(pub):
resp.form['f0'] = 'test'
resp = resp.form.submit('submit')
assert 'Check values then click submit.' in resp.text
assert not 'form_captcha' in resp.text
assert 'form_captcha' not in resp.text
def test_form_captcha_and_no_validation_page(pub):
@ -3530,7 +3530,7 @@ def test_form_file_field_image_submit(pub):
resp = app.get('/test/')
resp.forms[0]['f0$file'] = upload
resp = resp.forms[0].submit('submit')
assert not '<img alt="" src="tempfile?' in resp.text
assert '<img alt="" src="tempfile?' not in resp.text
def test_form_file_field_submit_document_type(pub):
@ -3694,7 +3694,7 @@ def test_form_table_field_submit(pub, emails):
formdef.store()
resp = get_app(pub).get('/test/')
resp = resp.form.submit('submit')
assert not 'Check values then click submit.' in resp.text
assert 'Check values then click submit.' not in resp.text
resp = get_app(pub).get('/test/')
resp.form['f0$c-0-0'] = 'a'
@ -3747,7 +3747,7 @@ def test_form_table_rows_field_submit(pub, emails):
formdef.store()
resp = get_app(pub).get('/test/')
resp = resp.form.submit('submit')
assert not 'Check values then click submit.' in resp.text
assert 'Check values then click submit.' not in resp.text
resp = get_app(pub).get('/test/')
resp.form['f0$element0$col0'] = 'a'
@ -3891,7 +3891,7 @@ def test_form_map_field_back_and_submit(pub):
# check required field
resp = resp.forms[0].submit('submit')
assert not 'Check values then click submit.' in resp.text
assert 'Check values then click submit.' not in resp.text
assert 'data-geolocation="road"' in resp.text
resp.forms[0]['f1'].value = 'bla'
@ -4583,7 +4583,7 @@ def test_form_string_field_autocomplete(pub):
# not filled completed, no call to .autocomplete
resp = get_app(pub).get('/test/')
assert not ').autocomplete({' in resp.text
assert ').autocomplete({' not in resp.text
# straight URL
formdef.fields[0].data_source = {'type': 'jsonp', 'value': 'http://example.org'}
@ -5007,7 +5007,7 @@ def test_workflow_condition_on_message(pub):
display1.condition = {'type': 'django', 'value': 'xxx'}
workflow.store()
page = app.get(formdata.get_url())
assert not 'message-to-all' in page.text
assert 'message-to-all' not in page.text
def test_session_cookie_flags(pub):
@ -5037,7 +5037,7 @@ def test_form_page_profile_verified_prefill(pub):
resp = login(get_app(pub), username='foo', password='foo').get('/test/')
assert resp.form['f0'].value == 'foo@localhost'
assert not 'readonly' in resp.form['f0'].attrs
assert 'readonly' not in resp.form['f0'].attrs
resp.form['f0'].value = 'Hello'
resp = resp.form.submit('submit')
assert 'Check values then click submit.' in resp.text
@ -5077,7 +5077,7 @@ def test_form_page_profile_verified_prefill(pub):
resp.form['f0'].value = 'Hello' # try changing
resp = resp.form.submit('previous')
assert 'readonly' in resp.form['f0'].attrs
assert not 'Check values then click submit.' in resp.text
assert 'Check values then click submit.' not in resp.text
assert resp.form['f0'].value == 'foo@localhost'
# try it without validation page
@ -5147,7 +5147,7 @@ def test_form_page_profile_verified_date_prefill(pub):
resp = login(get_app(pub), username='foo', password='foo').get('/test/')
assert resp.form['f0'].value == '2018-09-27'
assert not 'readonly' in resp.form['f0'].attrs
assert 'readonly' not in resp.form['f0'].attrs
resp.form['f0'].value = '2018-09-27'
resp = resp.form.submit('submit')
assert 'Check values then click submit.' in resp.text
@ -5678,7 +5678,7 @@ def test_items_field_with_disabled_items(http_requests, pub):
data = {'data': [{'id': '1', 'text': 'hello', 'disabled': True}, {'id': '2', 'text': 'world'}]}
urlopen.side_effect = lambda *args: io.StringIO(json.dumps(data))
resp = get_app(pub).get('/test/')
assert not 'f0$element1' in resp.form.fields
assert 'f0$element1' not in resp.form.fields
resp.form['f0$element2'].checked = True
resp = resp.form.submit('submit') # -> validation page
resp = resp.form.submit('submit') # -> submit
@ -6318,7 +6318,7 @@ def test_form_custom_select_template(pub):
formdef.store()
formdef.data_class().wipe()
resp = get_app(pub).get('/test/')
assert not 'TEST TEMPLATE' in resp.text
assert 'TEST TEMPLATE' not in resp.text
formdef.fields[0].extra_css_class = 'template-test'
formdef.store()
@ -6407,7 +6407,7 @@ def test_user_global_action(pub):
formdata = formdef.data_class().select()[0]
resp = app.get(formdata.get_url())
assert not 'button-action-1' in resp.text
assert 'button-action-1' not in resp.text
trigger.roles = ['_submitter']
workflow.store()
@ -6813,7 +6813,7 @@ def test_field_unicode_condition(pub):
resp = get_app(pub).get('/foo/')
resp.form['f1'] = 'hello'
resp = resp.form.submit('submit')
assert not 'f4' in resp.form.fields
assert 'f4' not in resp.form.fields
resp = get_app(pub).get('/foo/')
resp.form['f1'] = 'éléphant'
@ -6844,7 +6844,7 @@ def test_field_unicode_condition_contains_in_list(pub):
resp = get_app(pub).get('/foo/')
resp.form['f1'] = 'hello'
resp = resp.form.submit('submit')
assert not 'f4' in resp.form.fields
assert 'f4' not in resp.form.fields
resp = get_app(pub).get('/foo/')
resp.form['f1'] = 'éléphant'
@ -6875,7 +6875,7 @@ def test_field_unicode_condition_contains_in_string(pub):
resp = get_app(pub).get('/foo/')
resp.form['f1'] = 'hello'
resp = resp.form.submit('submit')
assert not 'f4' in resp.form.fields
assert 'f4' not in resp.form.fields
resp = get_app(pub).get('/foo/')
resp.form['f1'] = 'éléphant'
@ -6928,7 +6928,7 @@ def test_field_unicode_condition_in_array(pub):
resp = get_app(pub).get('/foo/')
resp.form['f1$element1'].checked = True
resp = resp.form.submit('submit')
assert not 'f3' in resp.form.fields
assert 'f3' not in resp.form.fields
resp = get_app(pub).get('/foo/')
resp.form['f1$element1'].checked = True
@ -7186,7 +7186,7 @@ def test_field_live_select_content(pub, http_requests):
assert live_resp.json['result']['1']['visible']
assert live_resp.json['result']['2']['visible']
assert live_resp.json['result']['3']['visible']
assert not 'items' in live_resp.json['result']['3']
assert 'items' not in live_resp.json['result']['3']
resp.form['f2'] = 'plop'
live_resp = app.post('/foo/live?modified_field_id=2', params=resp.form.submit_fields())
assert live_resp.json['result']['1']['visible']
@ -7237,7 +7237,7 @@ def test_field_live_select_content(pub, http_requests):
assert live_resp.json['result']['1']['visible']
assert live_resp.json['result']['2']['visible']
assert live_resp.json['result']['3']['visible']
assert not 'items' in live_resp.json['result']['3']
assert 'items' not in live_resp.json['result']['3']
resp.form['f2'] = 'plop'
live_resp = app.post('/foo/live?modified_field_id=2', params=resp.form.submit_fields())
assert live_resp.json['result']['1']['visible']
@ -7324,7 +7324,7 @@ def test_field_live_select_content_on_workflow_form(pub, http_requests):
assert live_resp.json['result']['xxx_1']['visible']
assert live_resp.json['result']['xxx_2']['visible']
assert live_resp.json['result']['xxx_3']['visible']
assert not 'items' in live_resp.json['result']['xxx_3']
assert 'items' not in live_resp.json['result']['xxx_3']
resp.form['fxxx_2'] = 'plop'
live_resp = app.post('/test/1/live?modified_field_id=xxx_2', params=resp.form.submit_fields())
assert live_resp.json['result']['xxx_1']['visible']
@ -7968,7 +7968,7 @@ def test_form_recall_draft(pub):
app = login(get_app(pub), username='foo', password='foo')
resp = app.get('/test/')
assert not 'You already started to fill this form.' in resp.text
assert 'You already started to fill this form.' not in resp.text
draft = formdef.data_class()()
draft.user_id = user.id

View File

@ -334,7 +334,7 @@ def test_update_profile():
HOBO_JSON['profile']['fields'][8]['disabled'] = True
hobo_cmd.update_profile(profile, pub)
formdef = UserFieldsFormDef(pub)
assert not '_mobile' in [x.id for x in formdef.fields]
assert '_mobile' not in [x.id for x in formdef.fields]
# add a custom local field
formdef = UserFieldsFormDef(pub)
@ -353,7 +353,7 @@ def test_update_profile():
attribute_name = str(field['name'])
field_id = str('_' + attribute_name)
if field.get('disabled'):
assert not attribute_name in attribute_mapping
assert attribute_name not in attribute_mapping
else:
assert attribute_mapping[attribute_name] == field_id

View File

@ -603,7 +603,7 @@ M. Francis Kuntz
assert emails.emails['test']['msg'].get_payload()[1].get_content_type() == 'text/html'
html = emails.emails['test']['msg'].get_payload()[1].get_payload(decode=True)
assert html.count(b'<ol') == 1
assert not b'<ul' in html
assert b'<ul' not in html
assert b'arabic simple' in html
assert b'M. Francis Kuntz' in html

View File

@ -156,8 +156,8 @@ def test_get_tenants():
os.mkdir(os.path.join(pub.APP_DIR, 'plop.invalid'))
tenants = list(pub.__class__.get_tenants())
assert 'example.net' in tenants
assert not 'xxx' in tenants
assert not 'plop.invalid' in tenants
assert 'xxx' not in tenants
assert 'plop.invalid' not in tenants
def test_register_cronjobs():

View File

@ -1138,7 +1138,7 @@ def test_migration_2_formdef_id_in_views():
union = ' UNION '.join(
['''SELECT %s FROM %s''' % (', '.join([y[1] for y in common_fields]), x) for x in view_names]
)
assert not 'formdef_id' in union
assert 'formdef_id' not in union
cur.execute('''CREATE VIEW wcs_all_forms AS %s''' % union)
sql.migrate()

View File

@ -186,7 +186,7 @@ def test_table_list_rows_set_many_values():
for row in range(10):
for col in range(3):
assert 'test$element%d$col%d' % (row, col) in form.as_html
assert not 'test$element%d$col%d' % (10, 0) in form.as_html
assert 'test$element%d$col%d' % (10, 0) not in form.as_html
mock_form_submission(req, widget, click='test$add_element')
widget = TableListRowsWidget('test', columns=['a', 'b', 'c'])
@ -1128,7 +1128,7 @@ def test_map_widget():
assert widget.parse() == '1.23;2.34'
assert '<label' in str(widget.render())
assert not '<label ' in str(widget.render_widget_content())
assert '<label ' not in str(widget.render_widget_content())
pub.load_site_options()
pub.site_options.set('options', 'map-bounds-top-left', '1.23;2.34')

View File

@ -51,7 +51,7 @@ def test_named_wscall(pub):
wscall.slug = 'bye'
wscall.store()
assert 'bye' in NamedWsCall.keys()
assert not 'hello_1' in NamedWsCall.keys()
assert 'hello_1' not in NamedWsCall.keys()
def test_webservice_substitution_variable(http_requests, pub):
@ -77,7 +77,7 @@ def test_webservice_auto_sign(http_requests, pub):
wscall.call()
except Exception:
pass
assert not 'signature=' in http_requests.get_last('url')
assert 'signature=' not in http_requests.get_last('url')
wscall.request = {'url': 'http://idp.example.net'}
try:
@ -101,7 +101,7 @@ def test_webservice_auto_sign(http_requests, pub):
wscall.call()
except Exception:
pass
assert not 'orig=example.net' in http_requests.get_last('url')
assert 'orig=example.net' not in http_requests.get_last('url')
assert 'signature=' in http_requests.get_last('url')