Commit 12009c39 authored by Jérome Perrin's avatar Jérome Perrin

ui_test: update more cases of users created in the test

When a test needs to login as manager again, the best way is to use
${manager_username} and ${manager_password} set in cookies before
running tests.

This is continuation of 445e8fa8 (ERP5TypeTestCase: rework default
manager password generation, 2024-05-27)
parent c0f8e30b
Pipeline #34984 failed with stage
in 0 seconds
...@@ -22,12 +22,6 @@ ...@@ -22,12 +22,6 @@
<td></td> <td></td>
</tr> </tr>
<tr>
<td>open</td>
<td>${base_url}/ERP5Site_addManagerAclUserIfNotExisting</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" /> <tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tr> <tr>
...@@ -85,9 +79,19 @@ ...@@ -85,9 +79,19 @@
wait python: False; wait python: False;
submit_name python: '//input[@value=\'Login\']'; submit_name python: '//input[@value=\'Login\']';
"> ">
<tr>
<td>storeEval</td>
<td>selenium.getCookieByName("manager_username")</td>
<td>manager_username</td>
</tr>
<tr>
<td>storeEval</td>
<td>selenium.getCookieByName("manager_password")</td>
<td>manager_password</td>
</tr>
<tal:block metal:use-macro="python: context.Zuite_CommonTemplate.macros['login']"> <tal:block metal:use-macro="python: context.Zuite_CommonTemplate.macros['login']">
<tal:block metal:fill-slot="username">user_logout_test</tal:block> <tal:block metal:fill-slot="username">${manager_username}</tal:block>
<tal:block metal:fill-slot="password">user_logout_test</tal:block> <tal:block metal:fill-slot="password">${manager_password}</tal:block>
</tal:block> </tal:block>
</tal:block> </tal:block>
<tr> <tr>
......
acl_users = context.getPortalObject().acl_users
if not acl_users.getUserById('user_logout_test'):
acl_users.zodb_users.manage_addUser(
user_id='user_logout_test',
login_name='user_logout_test',
password='user_logout_test',
confirm='user_logout_test',
)
# BBB for PAS 1.9.0 we pass a response and undo the redirect
response = container.REQUEST.RESPONSE
acl_users.zodb_roles.manage_assignRoleToPrincipals(
'Manager',
('user_logout_test',),
RESPONSE=response)
response.setStatus(200)
return 'done'
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_addManagerAclUserIfNotExisting</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -11,25 +11,6 @@ ...@@ -11,25 +11,6 @@
</thead><tbody> </thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> <tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tr>
<td>openAndWait</td>
<td>${base_url}/ERP5Site_createPersonWhoHasPermissionToAccess</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>done</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tr>
<td>assertTextPresent</td>
<td>Done.</td>
<td></td>
</tr>
<tr> <tr>
<td>open</td> <td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/portal_preferences/default_system_preference</td> <td>${base_url}/web_site_module/renderjs_runner/#/portal_preferences/default_system_preference</td>
...@@ -68,10 +49,15 @@ ...@@ -68,10 +49,15 @@
<td></td> <td></td>
</tr> </tr>
<tr>
<td>storeEval</td>
<td>selenium.getCookieByName("manager_username")</td>
<td>manager_username</td>
</tr>
<tr> <tr>
<td>type</td> <td>type</td>
<td>//textarea[@name='field_my_preferred_html_style_allowed_user_id_list']</td> <td>//textarea[@name='field_my_preferred_html_style_allowed_user_id_list']</td>
<td>user_logout_test</td> <td>${manager_username}</td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" />
...@@ -103,9 +89,19 @@ ...@@ -103,9 +89,19 @@
login_form_url python: '${base_url}'; login_form_url python: '${base_url}';
submit_name python: '//input[@value=\'Login\']'; submit_name python: '//input[@value=\'Login\']';
"> ">
<tr>
<td>storeEval</td>
<td>selenium.getCookieByName("manager_username")</td>
<td>manager_username</td>
</tr>
<tr>
<td>storeEval</td>
<td>selenium.getCookieByName("manager_password")</td>
<td>manager_password</td>
</tr>
<tal:block metal:use-macro="python: context.Zuite_CommonTemplate.macros['login']"> <tal:block metal:use-macro="python: context.Zuite_CommonTemplate.macros['login']">
<tal:block metal:fill-slot="username">user_logout_test</tal:block> <tal:block metal:fill-slot="username">${manager_username}</tal:block>
<tal:block metal:fill-slot="password">user_logout_test</tal:block> <tal:block metal:fill-slot="password">${manager_password}</tal:block>
</tal:block> </tal:block>
</tal:block> </tal:block>
...@@ -184,8 +180,8 @@ ...@@ -184,8 +180,8 @@
submit_name python: '//input[@value=\'Login\']'; submit_name python: '//input[@value=\'Login\']';
"> ">
<tal:block metal:use-macro="python: context.Zuite_CommonTemplate.macros['login']"> <tal:block metal:use-macro="python: context.Zuite_CommonTemplate.macros['login']">
<tal:block metal:fill-slot="username">user_logout_test</tal:block> <tal:block metal:fill-slot="username">${manager_username}</tal:block>
<tal:block metal:fill-slot="password">user_logout_test</tal:block> <tal:block metal:fill-slot="password">${manager_password}</tal:block>
</tal:block> </tal:block>
</tal:block> </tal:block>
......
...@@ -88,9 +88,19 @@ ...@@ -88,9 +88,19 @@
wait python: False; wait python: False;
submit_name python: '//input[@value=\'Login\']'; submit_name python: '//input[@value=\'Login\']';
"> ">
<tr>
<td>storeEval</td>
<td>selenium.getCookieByName("manager_username")</td>
<td>manager_username</td>
</tr>
<tr>
<td>storeEval</td>
<td>selenium.getCookieByName("manager_password")</td>
<td>manager_password</td>
</tr>
<tal:block metal:use-macro="python: context.Zuite_CommonTemplate.macros['login']"> <tal:block metal:use-macro="python: context.Zuite_CommonTemplate.macros['login']">
<tal:block metal:fill-slot="username">user_logout_test</tal:block> <tal:block metal:fill-slot="username">${manager_username}</tal:block>
<tal:block metal:fill-slot="password">user_logout_test</tal:block> <tal:block metal:fill-slot="password">${manager_password}</tal:block>
</tal:block> </tal:block>
</tal:block> </tal:block>
...@@ -181,8 +191,8 @@ ...@@ -181,8 +191,8 @@
wait python: False; wait python: False;
submit_name python: '//input[@value=\'Login\']'; submit_name python: '//input[@value=\'Login\']';
"><tal:block metal:use-macro="python: context.Zuite_CommonTemplate.macros['login']"> "><tal:block metal:use-macro="python: context.Zuite_CommonTemplate.macros['login']">
<tal:block metal:fill-slot="username">user_logout_test</tal:block> <tal:block metal:fill-slot="username">${manager_username}</tal:block>
<tal:block metal:fill-slot="password">user_logout_test</tal:block> <tal:block metal:fill-slot="password">${manager_password}</tal:block>
</tal:block></tal:block> </tal:block></tal:block>
<tr> <tr>
......
acl_users = context.getPortalObject().acl_users
if not acl_users.getUserById('user_logout_test'):
acl_users.zodb_users.manage_addUser(
user_id='user_logout_test',
login_name='user_logout_test',
password='user_logout_test',
confirm='user_logout_test',
)
# BBB for PAS 1.9.0 we pass a response and undo the redirect
response = container.REQUEST.RESPONSE
acl_users.zodb_roles.manage_assignRoleToPrincipals(
'Manager',
('user_logout_test',),
RESPONSE=response)
response.setStatus(200)
return 'done'
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_createPersonWhoHasPermissionToAccess</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment