From c8044b9aea816931ed4edb98a75efc31949fc221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 19 Jun 2019 19:03:14 +0200 Subject: [PATCH] tests: visit actions that are not available by default --- tests/test_admin_pages.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_admin_pages.py b/tests/test_admin_pages.py index 36b762541..44f8f8929 100644 --- a/tests/test_admin_pages.py +++ b/tests/test_admin_pages.py @@ -2271,6 +2271,13 @@ def test_workflows_check_available_actions(pub): assert not 'Criticality Levels' in [x[0] for x in resp.forms[0]['action-formdata-action'].options] assert not 'SMS' in [x[0] for x in resp.forms[0]['action-interaction'].options] + assert not 'User Notification' in [x[0] for x in resp.forms[0]['action-interaction'].options] + + if not pub.site_options.has_section('variables'): + pub.site_options.add_section('variables') + pub.site_options.set('variables', 'portal_url', 'https://www.example.net/') + with open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w') as fd: + pub.site_options.write(fd) pub.cfg['sms'] = {'mode': 'foobar'} pub.write_cfg() @@ -2280,6 +2287,21 @@ def test_workflows_check_available_actions(pub): resp = resp.click('baz') assert 'Criticality Levels' in [x[0] for x in resp.forms[0]['action-formdata-action'].options] assert 'SMS' in [x[0] for x in resp.forms[0]['action-interaction'].options] + assert 'User Notification' in [x[0] for x in resp.forms[0]['action-interaction'].options] + + for action in ('Criticality Levels', 'SMS', 'User Notification'): + for category in ('status-change', 'interaction', 'formdata-action', 'user-action'): + if action in [x[0] for x in resp.forms[0]['action-%s' % category].options if x[0]]: + resp.forms[0]['action-%s' % category] = action + resp = resp.forms[0].submit() + resp = resp.follow() + + for i in range(3): + resp = resp.click('Edit', href='items/%d/' % (i+1), index=0) + resp = resp.forms[0].submit('cancel') + resp = resp.follow() # redirect to items/ + resp = resp.follow() # redirect to ./ + def test_workflows_edit_dispatch_action(pub): create_superuser(pub)