Commit 3388ac0c authored by Vincent Bechu's avatar Vincent Bechu

[officejs_test] Add tests on new appstore interfaces

parent aef537b1
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Zuite" module="Products.Zelenium.zuite"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>officejs_appstore_ui_zuite</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testOfficeJSAppstoreRegisterAndLogin</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test OfficeJS Appstore UI</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test RenderJS UI</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOfficejsAppstoreUi/macros/appstore_init" />
<tr>
<td>open</td>
<td>${base_url}/ERP5Site_removeTestUserList</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>open</td>
<td>${base_url}/web_site_module/officejs_runner/WebSite_logout</td>
<td></td>
</tr>
<!-- Initialize -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/officejs_runner/</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@value='Login']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[text()=' Create New Account ']</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//a[text()=' Create New Account ']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name='password']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name='reference']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@value='Register']</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//input[@name='reference']</td>
<td>demo@nexedi.com</td>
</tr>
<tr>
<td>type</td>
<td>//input[@name='password']</td>
<td>testSlapOSJSSubscribeUser</td>
</tr>
<tr>
<td>type</td>
<td>//input[@name='password_confirmation']</td>
<td>testSlapOSJSSubscribeUser</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//input[@value='Register']</td>
<td></td>
</tr>
<tr>
<td>assertTextNotPresent</td>
<td>Selected login is already in use, please choose different one.</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@value='Login']</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Credential Request Created.</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<!-- Initialize -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/officejs_runner/</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>__ac_name</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>__ac_name</td>
<td>demo@nexedi.com</td>
</tr>
<tr>
<td>type</td>
<td>__ac_password</td>
<td>testSlapOSJSSubscribeUser</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@value="Login"]</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//input[@value="Login"]</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOfficejsAppstoreUi/macros/logout" />
</tbody></table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testOfficeJSAppstoreRegisterFail</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test OfficeJS Appstore UI</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test RenderJS UI</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/officejs_runner/WebSite_logout</td>
<td></td>
</tr>
<!-- Account already exist -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/officejs_runner/</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@value='Login']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[text()=' Create New Account ']</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//a[text()=' Create New Account ']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name='password']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name='reference']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@value='Register']</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//input[@name='reference']</td>
<td>demo@nexedi.com</td>
</tr>
<tr>
<td>type</td>
<td>//input[@name='password']</td>
<td>testSlapOSJSSubscribeUser</td>
</tr>
<tr>
<td>type</td>
<td>//input[@name='password_confirmation']</td>
<td>testSlapOSJSSubscribeUser</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//input[@value='Register']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope='notification' and @class='visible']//button[@class='error']</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Selected email is already in use, please choose different one.</td>
<td></td>
</tr>
<!-- Password and confirmation not same -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/officejs_runner/</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@value='Login']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[text()=' Create New Account ']</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//a[text()=' Create New Account ']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name='password']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name='reference']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@value='Register']</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//input[@name='reference']</td>
<td>demo@nexedi.com</td>
</tr>
<tr>
<td>type</td>
<td>//input[@name='password']</td>
<td>testSlapOSJSSubscribeUser</td>
</tr>
<tr>
<td>type</td>
<td>//input[@name='password_confirmation']</td>
<td>2713</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//input[@value='Register']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope='notification' and @class='visible']//button[@class='error']</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Password and Confirmation Password must be same</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>officejs_test</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
context.WebSection_newCredentialRequest(
reference="demo@nexedi.com",
password="demo_functional_user",
password_confirmation='demo_functional_user',
batch_mode=1
)
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>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>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_createTestUserList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
portal = context.getPortalObject()
for cr in portal.portal_catalog(reference=["demo@nexedi.com", "admin@nexedi.com"],
portal_type="Credential Request"):
related_person = cr.getDestinationDecisionValue()
if related_person is not None:
portal.person_module.manage_delObjects(ids=[related_person.getId()])
event_list = cr.getFollowUpRelatedValueList()
if len(event_list):
portal.event_module.manage_delObjects(ids=[e.getId() for e in event_list])
portal.credential_request_module.manage_delObjects(ids=[cr.getId()])
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>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>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_removeTestUserList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_CommonTemplateForOfficejsAppstoreUi</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<tal:block metal:define-macro="appstore_init">
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tr>
<td>openAndWait</td>
<td>${base_url}/ERP5Site_setupDummyMailHost</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>True</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/ERP5Site_removeTestUserList</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>
<td>open</td>
<td>${base_url}/web_site_module/officejs_runner/ERP5Site_createTestUserList</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>
</tal:block>
<tal:block metal:define-macro="login_as_user">
<!-- Logout -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/officejs_runner/WebSite_logout</td>
<td></td>
</tr>
<!-- Initialize -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/officejs_runner/</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>__ac_name</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>__ac_name</td>
<td>demo@nexedi.com</td>
</tr>
<tr>
<td>type</td>
<td>__ac_password</td>
<td>demo_functional_user</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@value="Login"]</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//input[@value="Login"]</td>
<td></td>
</tr>
</tal:block>
<tal:block metal:define-macro="login_as_admin">
<!-- Logout -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/officejs_runner/WebSite_logout</td>
<td></td>
</tr>
<!-- Initialize -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/officejs_runner/</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>__ac_name</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>__ac_name</td>
<td>admin@nexedi.com</td>
</tr>
<tr>
<td>type</td>
<td>__ac_password</td>
<td>password</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@value="Login"]</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//input[@value="Login"]</td>
<td></td>
</tr>
</tal:block>
<tal:block metal:define-macro="logout">
<!-- Logout -->
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n='Logout']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[@data-i18n='Logout']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@value='Confirm']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//input[@value='Confirm']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@value='Login']</td>
<td></td>
</tr>
</tal:block>
</tal:block>
\ No newline at end of file
##############################################################################
#
# Copyright (c) 2011 Nexedi SARL and Contributors. All Rights Reserved.
# Kazuhiko <kazuhiko@nexedi.com>
# Rafael Monnerat <rafael@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import unittest
from Products.ERP5Type.tests.ERP5TypeFunctionalTestCase import ERP5TypeFunctionalTestCase
class TestOfficejSAppstoreUI(ERP5TypeFunctionalTestCase):
foreground = 0
run_only = "officejs_appstore_ui_zuite"
def getBusinessTemplateList(self):
return (
'officejs_base',
'officejs_test',
'officejs_security',
)
def afterSetUp(self):
super(TestOfficejSAppstoreUI, self).afterSetUp()
self.portal.portal_preferences.getActiveSystemPreference().edit(
preferred_credential_alarm_automatic_call=1,
preferred_credential_recovery_automatic_approval=1,
preferred_credential_request_automatic_approval=1
)
self.tic()
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestOfficejSAppstoreUI))
return suite
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testFunctionalOfficeJSAppstoreUI</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testFunctionalOfficeJSAppstoreUI</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
from Products.ERP5Type.tests.SecurityTestCase import SecurityTestCase
import time
from StringIO import StringIO
import zipfile
import httplib
import urlparse
class LocalStringIO(StringIO):
__allow_access_to_unprotected_subobjects__=1
def __init__(self, filename, *args, **kw):
self.filename = filename
StringIO.__init__(self, *args, **kw)
class TestOfficeJSScenario(SecurityTestCase):
def getTitle(self):
return "Test OfficeJS Scenario"
def getBusinessTemplateList(self):
"""
Tuple of Business Templates we need to install
"""
return ('officejs_meta',)
def createNewUser(self,
first_name="John_test",
last_name="Smith_test",
email="john.smith@example.com"):
"""
Add new member using script for the website sign-in
"""
user = self.portal.person_module.newContent(
portal_type="Person",
first_name=first_name,
last_name=last_name,
default_email_coordinate_text=email,
career_role_list=["author"]
)
user.validate()
assignment = user.newContent(portal_type="Assignment", role="author")
assignment.open()
return user
def createNewAdmin(self,
first_name="Brandon_test",
last_name="Cougar_test",
email="brandon.cougar@example.com"):
"""
Add new member using script for the website sign-in
"""
user = self.portal.person_module.newContent(
portal_type="Person",
first_name=first_name,
last_name=last_name,
default_email_coordinate_text=email,
career_role_list=["administration"]
)
user.validate()
assignment = user.newContent(portal_type="Assignment", group="my_group")
assignment.open()
return user
def test_01_user_can_contribute(self):
timestamp = "%s" % time.time()
###################################
### Manager: Create user
person_user = self.createNewUser()
person_admin = self.createNewAdmin()
self.tic()
###################################
### User: submit application
self.logout()
self.login(person_user.getUserId())
import_file = LocalStringIO('your.zip')
my_zip = zipfile.ZipFile(import_file, 'w')
my_zip.writestr('index.html', 'My super content')
for i in range(50):
my_zip.writestr('gadget_n_' + str(i) + '.html', 'My super gadget ' + str(i))
my_zip.close()
title = 'My Application %s' % timestamp
self.portal.SoftwareProductModule_createNewApplication(
import_file,
title
)
###################################
### Alarm: extract zip file
self.logout()
self.login()
self.tic()
self.portal.portal_alarms.officejs_process_submit_software_publication\
.activeSense()
self.tic()
software_product = self.portal.portal_catalog.getResultValue(
portal_type='Software Product',
title=title
)
web_site = software_product.SoftwareProduct_getRelatedWebSite()
web_section = web_site.objectValues()[0]
###################################
### Anonymous: access the redirect application
self.logout()
api_scheme, api_netloc, api_path, api_query, \
api_fragment = urlparse.urlsplit(self.portal.absolute_url())
connection = httplib.HTTPConnection(api_netloc)
connection.request(
method='GET',
url='%s/' % web_section.getParentValue().absolute_url()
)
response = connection.getresponse()
page_content = response.read()
self.assertTrue(
'document.location.replace("development/" + document.location.hash)' in page_content,
page_content
)
self.assertTrue(
'manifest="WebSection_renderOfficeJSRedirectAppCache"' in page_content,
page_content
)
self.assertEquals(response.status, 200)
self.assertEquals(
response.getheader('Cache-Control'),
'max-age=0, public, must-revalidate'
)
self.assertTrue(
'text/html;' in response.getheader('Content-Type'),
response.getheader('Content-Type')
)
self.assertEquals(
response.getheader('Content-Security-Policy'),
"default-src 'self'; script-src 'unsafe-inline';"
)
self.assertEquals(
response.getheader('X-Frame-Options'),
'SAMEORIGIN'
)
self.assertEquals(
response.getheader('Vary').replace(' ', ''),
'Accept-Language,Cookie,Authorization,Accept-Encoding'
)
###################################
### Anonymous: access the redirect application appcache
connection.request(
method='GET',
url='%s/WebSection_renderOfficeJSRedirectAppCache' % web_section.getParentValue().absolute_url()
)
response = connection.getresponse()
page_content = response.read()
self.assertEquals("""CACHE MANIFEST
# development + hash""",
page_content
)
self.assertEquals(response.status, 200)
self.assertTrue(
'text/cache-manifest;' in response.getheader('Content-Type'),
response.getheader('Content-Type')
)
self.assertEquals(
response.getheader('Cache-Control'),
'max-age=0, public, must-revalidate'
)
self.assertEquals(
response.getheader('Vary'),
None
)
###################################
### Anonymous: access the application version
connection.request(
method='GET',
url='%s/' % web_section.absolute_url()
)
response = connection.getresponse()
self.assertEquals(response.read(), 'My super content')
self.assertEquals(response.status, 200)
self.assertEquals(
response.getheader('Cache-Control'),
'max-age=31536000, stale-while-revalidate=31536000, stale-if-error=31536000, public'
)
self.assertTrue(
'text/html;' in response.getheader('Content-Type'),
response.getheader('Content-Type')
)
self.assertEquals(
response.getheader('Content-Security-Policy'),
None
)
self.assertEquals(
response.getheader('X-Frame-Options'),
None
)
self.assertEquals(response.getheader('Vary'), None)
###################################
### User: open the publication to be accepted
self.logout()
self.login(person_user.getUserId())
software_publication = self.portal.portal_catalog.getResultValue(
portal_type='Software Publication',
reference='SP-%s' % web_section.getId()
)
software_publication.open()
self.tic()
###################################
### Anonymous: access the redirect application
self.logout()
api_scheme, api_netloc, api_path, api_query, \
api_fragment = urlparse.urlsplit(self.portal.absolute_url())
connection = httplib.HTTPConnection(api_netloc)
connection.request(
method='GET',
url='%s/' % web_section.getParentValue().absolute_url()
)
response = connection.getresponse()
page_content = response.read()
self.assertTrue(
'document.location.replace("development/" + document.location.hash)' in page_content,
page_content
)
self.assertTrue(
'manifest="WebSection_renderOfficeJSRedirectAppCache"' in page_content,
page_content
)
self.assertEquals(response.status, 200)
self.assertEquals(
response.getheader('Cache-Control'),
'max-age=0, public, must-revalidate'
)
self.assertTrue(
'text/html;' in response.getheader('Content-Type'),
response.getheader('Content-Type')
)
self.assertEquals(
response.getheader('Content-Security-Policy'),
"default-src 'self'; script-src 'unsafe-inline';"
)
self.assertEquals(
response.getheader('X-Frame-Options'),
'SAMEORIGIN'
)
self.assertEquals(
response.getheader('Vary').replace(' ', ''),
'Accept-Language,Cookie,Authorization,Accept-Encoding'
)
###################################
### Site admin: accept the software publication
self.logout()
self.login(person_admin.getUserId())
software_publication.accept()
self.tic()
###################################
### Anonymous: access the redirect application
self.logout()
connection.request(
method='GET',
url='%s/' % web_section.getParentValue().absolute_url()
)
response = connection.getresponse()
page_content = response.read()
self.assertTrue(
'document.location.replace("%s/" + document.location.hash)' % web_section.getId() in page_content,
page_content
)
self.assertTrue(
'manifest="WebSection_renderOfficeJSRedirectAppCache"' in page_content,
page_content
)
self.assertEquals(response.status, 200)
self.assertEquals(
response.getheader('Cache-Control'),
'max-age=0, public, must-revalidate'
)
self.assertTrue(
'text/html;' in response.getheader('Content-Type'),
response.getheader('Content-Type')
)
self.assertEquals(
response.getheader('Content-Security-Policy'),
"default-src 'self'; script-src 'unsafe-inline';"
)
self.assertEquals(
response.getheader('X-Frame-Options'),
'SAMEORIGIN'
)
self.assertEquals(
response.getheader('Vary').replace(' ', ''),
'Accept-Language,Cookie,Authorization,Accept-Encoding'
)
###################################
### Anonymous: access the redirect application appcache
connection.request(
method='GET',
url='%s/WebSection_renderOfficeJSRedirectAppCache' % web_section.getParentValue().absolute_url()
)
response = connection.getresponse()
page_content = response.read()
self.assertEquals("""CACHE MANIFEST
# %s + hash""" % web_section.getId(),
page_content
)
self.assertEquals(response.status, 200)
self.assertTrue(
'text/cache-manifest;' in response.getheader('Content-Type'),
response.getheader('Content-Type')
)
self.assertEquals(
response.getheader('Cache-Control'),
'max-age=0, public, must-revalidate'
)
self.assertEquals(
response.getheader('Vary'),
None
)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testOfficeJSScenarioRjsUI</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testOfficeJSScenarioRjsUI</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W:110, 28: Unused variable \'api_path\' (unused-variable)</string>
<string>W:110, 38: Unused variable \'api_query\' (unused-variable)</string>
<string>W:110, 4: Unused variable \'api_scheme\' (unused-variable)</string>
<string>W:111, 6: Unused variable \'api_fragment\' (unused-variable)</string>
</tuple>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
officejs_base officejs_base
officejs_security officejs_security
officejs_credential
erp5_ui_test
\ No newline at end of file
portal_tests/officejs_appstore_ui_zuite
portal_tests/officejs_appstore_ui_zuite/**
\ No newline at end of file
officejs_test
\ No newline at end of file
test.erp5.testOfficeJSSecurity test.erp5.testOfficeJSSecurity
test.erp5.testOfficeJSScenario test.erp5.testOfficeJSScenario
test.erp5.testOfficeJSScenarioRjsUI
test.erp5.testFunctionalOfficeJSAppstoreUI
\ No newline at end of file
...@@ -16,6 +16,7 @@ class OfficeJS(ERP5TypeTestSuite): ...@@ -16,6 +16,7 @@ class OfficeJS(ERP5TypeTestSuite):
for test_path in ( for test_path in (
glob('%s/bt5/*/TestTemplateItem/portal_components/test.ojs.*.py' % path) + glob('%s/bt5/*/TestTemplateItem/portal_components/test.ojs.*.py' % path) +
glob('%s/bt5/*/TestTemplateItem/portal_components/test.ojs.testFunctionalOfficeJSAppstore*.py' % path) +
glob('%s/bt5/*/TestTemplateItem/portal_components/test.*.testOfficeJS*.py' % path) glob('%s/bt5/*/TestTemplateItem/portal_components/test.*.testOfficeJS*.py' % path)
): ):
component_re_match = component_re.match(test_path) component_re_match = component_re.match(test_path)
......
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