Commit 36561951 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio_ui_test: Start to test Status Gadget

   - Add script to emulare slapgrid work on accessing site as a Computer.
parent 984b64c9
......@@ -11,7 +11,7 @@ from AccessControl.SecurityManagement import newSecurityManager
import xml_marshaller
def ComputeNode_simulateSlapgridCP(self, instance_connection_dict=None,
def ComputeNode_simulateSlapgridInstance(self, instance_connection_dict=None,
slave_connection_dict=None):
if slave_connection_dict is None:
......@@ -73,6 +73,30 @@ def ComputeNode_simulateSlapgridCP(self, instance_connection_dict=None,
finally:
setSecurityManager(sm)
def ComputeNode_simulateSlapgridSoftware(self):
sm = getSecurityManager()
portal = self.getPortalObject()
compute_node_user_id = self.getUserId()
try:
newSecurityManager(None, portal.acl_users.getUserById(compute_node_user_id))
compute_node_xml = portal.portal_slap.getFullComputerInformation(
computer_id=self.getReference())
if not isinstance(compute_node_xml, str):
compute_node_xml = compute_node_xml.getBody()
slap_compute_node = xml_marshaller.xml_marshaller.loads(compute_node_xml)
assert 'Computer' == slap_compute_node.__class__.__name__
for software_release in slap_compute_node._software_release_list:
if software_release._requested_state == 'destroyed':
portal.portal_slap.destroyedSoftwareRelease(
software_release._software_release,
self.getReference())
else:
portal.portal_slap.availableSoftwareRelease(
software_release._software_release,
self.getReference())
finally:
setSecurityManager(sm)
def ComputeNode_simulateSlapgridFormat(self, partition_count=10):
portal = self.getPortalObject()
......
......@@ -6,12 +6,6 @@
</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>SlapOSUiTest</string> </value>
......@@ -55,28 +49,13 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAI=</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>
......@@ -89,7 +68,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -98,7 +77,7 @@
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -22,6 +22,8 @@
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/create_simple_compute_node" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_activities_and_call_slapgrid" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_activities_and_front_page" />
......@@ -196,6 +198,7 @@
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/assert_page_header" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_activities_and_call_slapgrid" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_activities_and_front_page" />
......@@ -219,6 +222,16 @@
<td>//a[text()="TEST-SLAPOSJS-COMPUTER 0"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[text()="TEST-SLAPOSJS-COMPUTER 0"]</td>
......@@ -230,6 +243,26 @@
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/assert_page_header" />
</tal:block>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Available')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Available')]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td tal:content="python: '//th/a[text()=\'%s\']' % (here.Base_translateString('Software Release', lang=lang))"></td>
......@@ -255,6 +288,17 @@
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/assert_page_header" />
</tal:block>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Available')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Available')]</td>
<td></td>
</tr>
<tal:block define="menu_action python: 'Destroy'">
<tr>
<td colspan="3"><b tal:content="python: 'Click on %s' % menu_action"> Menu Item </b></td>
......
......@@ -8,7 +8,7 @@
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>ComputeNode_simulateSlapgridCP</string> </value>
<value> <string>ComputeNode_simulateSlapgridInstance</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
......@@ -16,7 +16,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ComputeNode_simulateSlapgridCP</string> </value>
<value> <string>ComputeNode_simulateSlapgridInstance</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>ComputeNode_simulateSlapgridSoftware</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>SlapOSUiTest</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ComputeNode_simulateSlapgridSoftware</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from DateTime import DateTime
portal = context.getPortalObject()
portal_membership=portal.portal_membership
demo_user_functional = portal_membership.getAuthenticatedMember().getUserValue()
for compute_node in portal.portal_catalog(
portal_type="Compute Node",
validation_state="validated",
default_source_administration_uid=demo_user_functional.getUid()):
if compute_node.getValidationState() == 'validated':
compute_node.ComputeNode_simulateSlapgridFormat()
compute_node.activate(
tag='ComputeNode_simulateSlapgridSoftware'
).ComputeNode_simulateSlapgridSoftware()
compute_node.activate(
after_tag='ComputeNode_simulateSlapgridSoftware'
).ComputeNode_simulateSlapgridInstance()
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>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_formatAndUpdateUserComputeNodeList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -29,7 +29,6 @@
</tal:block>
</tal:block>
<tal:block metal:define-macro="access_menu_item">
<tal:block tal:define="panel_gadget_id python: 'gadget_slapos_panel.html'">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item_base" />
......@@ -77,7 +76,7 @@
<td></td>
</tr>
<tr>
<td>open</td>
<td>openAndWait</td>
<td>${base_url}/ERP5Site_removeTestUserList</td>
<td></td>
</tr>
......@@ -86,16 +85,9 @@
<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>openAndWait</td>
<td tal:content="python:'${base_url}/web_site_module/%s/ERP5Site_createTestUserList' % web_site_id">.../ERP5Site_createTestUserList</td>
<td></td>
</tr>
......@@ -106,13 +98,6 @@
</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="slapos_login_base">
......@@ -122,7 +107,9 @@
<td tal:content="python:'${base_url}/web_site_module/%s/WebSite_logout' % web_site_id">.../WebSite_logout</td>
<td></td>
</tr>
<!-- Initialize -->
<tr>
<td colspan="3"><b> Login as demo_functional_user</b></td>
</tr>
<tr>
<td>open</td>
<td tal:content="python:'${base_url}/web_site_module/%s/' % web_site_id"></td>
......@@ -220,14 +207,10 @@
<tal:block metal:define-macro="slapos_wait_for_activities_and_front_page_base">
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tr>
<td>assertTextPresent</td>
<td>Done.</td>
<td></td>
<td colspan="3"><b> Wait for activities and return to the front page </b></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tr>
<td>open</td>
<td tal:content="python:'${base_url}/web_site_module/%s/' % web_site_id"></td>
......@@ -295,6 +278,25 @@
</tr>
</tal:block>
<tal:block metal:define-macro="slapos_wait_for_activities_and_call_slapgrid">
<tr>
<td colspan="3"><b> Wait for activities and simulate call Slapgrid </b></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tr>
<td>openAndWait</td>
<td>${base_url}/ERP5Site_formatAndUpdateUserComputeNodeList </td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Done.</td>
<td></td>
</tr>
</tal:block>
<tal:block metal:define-macro="slapos_logout">
<tr>
<td colspan="3"><b>Logout the website</b></td>
......@@ -1141,9 +1143,10 @@
<tal:block metal:define-macro="create_fake_invoice">
<tr>
<td colspan="3"><b> Create a fake invoice</b></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tr>
<td>assertTextPresent</td>
<td>Done.</td>
......@@ -1161,7 +1164,6 @@
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tr>
<td>assertTextPresent</td>
<td>Done.</td>
......@@ -1177,7 +1179,31 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@class="ui-content"]</td>
<td>//div[contains(@data-gadget-url, 'gadget_slapos_panel.html')]//div[@class="slapos_panel_extra_menu"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_slapos_panel.html')]//dl[@class="dl-contextual-help"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_slapos_panel.html')]//dl[@class="dl-contextual-help"]</td>
<td></td>
</tr>
</tal:block>
<tal:block metal:define-macro="suspend_user_tickets">
<tr>
<td>openAndWait</td>
<td>${base_url}/ERP5Site_suspendUserSupportRequest</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Done.</td>
<td></td>
</tr>
</tal:block>
......
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