Commit 95c862e1 authored by Rafael Monnerat's avatar Rafael Monnerat

Create a Second test user for Tutorial Tests

This is required for user-Howto.Manage.Support.Request-HTML5
parent 64c5a423
......@@ -61,6 +61,7 @@ for key in kw.keys():\n
result_list = context.portal_catalog(**query_dict)\n
owner_id = context.portal_membership.getAuthenticatedMember().getId()\n
functional_test_username = context.Zuite_getHowToInfo()[\'functional_test_username\']\n
functional_another_test_username = context.Zuite_getHowToInfo()[\'functional_another_test_username\']\n
\n
for result in result_list:\n
object = result.getObject()\n
......@@ -71,7 +72,7 @@ for result in result_list:\n
if strict_check_mode and method() != kw[key]:\n
raise RuntimeError, "One property is not the same that you wanted : you asked \'%s\' and expecting \'%s\' but get \'%s\'" % (key, kw[key], method())\n
# check that every object are owner by you\n
if strict_check_mode and object.Base_getOwnerId() not in [owner_id, functional_test_username, \'__erp5security-=__\']:\n
if strict_check_mode and object.Base_getOwnerId() not in [owner_id, functional_test_username, \'__erp5security-=__\', functional_another_test_username]:\n
raise RuntimeError, "You have try to clean an item who haven\'t you as owner : %s is owned by %s and you are %s" % \\\n
(object.getTitle(), object.Base_getOwnerId(), owner_id)\n
\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<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>_body</string> </key>
<value> <string>"""\n
Creates the functional test user, validate and open assignment.\n
"""\n
portal = context.getPortalObject()\n
howto_dict = context.Zuite_getHowToInfo()\n
\n
functional_test_username = howto_dict[\'functional_another_test_username\']\n
person = getattr(portal.person_module, functional_test_username, None)\n
if person is None:\n
person = portal.person_module.newContent(portal_type=\'Person\',\n
id=functional_test_username,\n
title=functional_test_username)\n
\n
person.edit(reference=functional_test_username,\n
password=howto_dict[\'functional_test_user_password\'],\n
default_email_text=howto_dict[\'functional_test_user_email\'])\n
\n
person.validate()\n
\n
assignment = person.newContent(portal_type=\'Assignment\',\n
start_date=\'01/01/2011\',\n
stop_date=\'01/01/2111\',\n
function=\'company/manager\')\n
assignment.open()\n
\n
# XXX (lucas): These tests must be able to run on an instance without security.\n
for role in (\'Assignee\', \'Assignor\', \'Associate\', \'Auditor\', \'Owner\'):\n
portal.acl_users.zodb_roles.assignRoleToPrincipal(role, functional_test_username)\n
\n
return \'Done.\'\n
</string> </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>Zuite_createAnotherFunctionalTestUser</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -168,6 +168,7 @@ return {\'now\': DateTime(),\n
\'dig_currency_title\': \'ZUITE_TEST_DIG_EURO\',\n
\n
\'functional_test_username\' : \'functional_test_username\',\n
\'functional_another_test_username\' : \'functional_another_test_username\',\n
\'functional_test_user_password\' : \'secret\',\n
\'functional_test_user_email\': \'lucas@nexedi.com\',\n
\n
......
......@@ -196,6 +196,69 @@
</tr>\n
</tal:block>\n
\n
<tal:block metal:define-macro="login_as_functional_another_test_user">\n
<tr>\n
<td>openAndWait</td>\n
<td>${base_url}/Zuite_createAnotherFunctionalTestUser</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>verifyTextPresent</td>\n
<td>Done.</td>\n
<td></td>\n
</tr>\n
<span metal:use-macro="container/Zuite_viewTestMacroLibrary/macros/wait_for_activities"> Wait for activities</span>\n
<tr>\n
<td>openAndWait</td>\n
<td>${base_url}/Base_clearCache</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertTextPresent</td>\n
<td>Cleared.</td>\n
<td></td>\n
</tr>\n
<!-- login with functional test user -->\n
<tr>\n
<td>openAndWait</td>\n
<td>${base_url}/logout</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>openAndWait</td>\n
<td>${base_url}/login_form</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>type</td>\n
<td>//input[@name="__ac_name"]</td>\n
<td tal:content="python:\n
here.Zuite_getHowToInfo()[\'functional_another_test_username\']"></td>\n
</tr>\n
<tr>\n
<td>type</td>\n
<td>//input[@name="__ac_password"]</td>\n
<td tal:content="python:\n
here.Zuite_getHowToInfo()[\'functional_test_user_password\']"></td>\n
</tr>\n
<tr>\n
<td>clickAndWait</td>\n
<td>//input[@name="logged_in:method"]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>openAndWait</td>\n
<td>${base_url}/view</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>verifyTextPresent</td>\n
<td tal:content="python:\n
here.Zuite_getHowToInfo()[\'functional_another_test_username\']"></td>\n
<td></td>\n
</tr>\n
</tal:block>\n
\n
<tal:block metal:define-macro="login_as_user">\n
<!-- login with newly created user from Express configuration -->\n
<tr>\n
......
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