Commit 1bf8c5a0 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5: Periodically test coverage with a CodingStyle test

See merge request nexedi/slapos.core!422
parents a225fb6c 777d6c62
portal = context.getPortalObject()
content_dict = {}
for test_component in portal.portal_components.searchFolder(portal_type='Test Component'):
if "Slap" not in test_component.getId():
continue
content_dict[test_component.getId()] = test_component.getTextContent()
print len(content_dict)
for skin_folder in portal.portal_skins.objectValues('Folder'):
if not skin_folder.getId().startswith("slapos"):
continue
for skin in skin_folder.objectValues():
if skin.getId().startswith("Alarm_"):
continue
if skin.meta_type in ('Script (Python)', 'Z SQL Method', ):
found = 0
for _, content in content_dict.iteritems():
if skin.getId() in content:
found = 1
break
if not found:
print "%s/%s" % (skin_folder.getId(), skin.getId())
container.REQUEST.RESPONSE.setHeader('content-type', 'text/plain')
return '\n'.join(sorted(printed.splitlines()))
<?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_testPythonScriptTestCoverage</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -59,6 +59,317 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template): ...@@ -59,6 +59,317 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template):
slapos_crm/PathTemplateItem/sale_trade_condition_module/slapos_ticket_trade_condition.xml slapos_crm/PathTemplateItem/sale_trade_condition_module/slapos_ticket_trade_condition.xml
slapos_payzen/PathTemplateItem/portal_secure_payments/slapos_payzen_test.xml slapos_payzen/PathTemplateItem/portal_secure_payments/slapos_payzen_test.xml
""" """
CodingStyleTestCase.coverage_ignore_path_list = [
'erp5_interaction_drop/InvoiceTransaction_postGeneration',
'erp5_interaction_drop/OpenOrderLine_updateSimulation',
'slapos_cloud/AlarmTool_checkComputeNodeMigrationConsistency',
'slapos_cloud/AlarmTool_checkInstanceTreeMigrationConsistency',
'slapos_cloud/AlarmTool_checkPredecessorToSuccessorMigrationConsistency',
'slapos_cloud/Base_getSoftwareReleaseStateOnComputeNode',
'slapos_cloud/Base_getSoftwareReleaseUsageOnComputeNode',
'slapos_cloud/ComputeNode_afterClone',
'slapos_cloud/ComputeNode_applyComputerModel',
'slapos_cloud/ComputeNode_getBusyComputePartitionList',
'slapos_cloud/ComputeNode_getFreeComputePartitionCount',
'slapos_cloud/ComputeNode_getSoftwareReleaseList',
'slapos_cloud/ComputeNode_getSoftwareReleaseState',
'slapos_cloud/ComputeNode_getSoftwareReleaseUrlStringList',
'slapos_cloud/ComputeNode_getSoftwareReleaseUsage',
'slapos_cloud/ComputeNode_getUsageReportUrl',
'slapos_cloud/ComputeNode_init',
'slapos_cloud/ComputeNode_initUserId',
'slapos_cloud/ComputePartition_getAvailableSoftwareReleaseUrlStringList',
'slapos_cloud/ComputePartition_getCustomAllocationParameterDict',
'slapos_cloud/ComputePartition_getInstanceTreeUrlString',
'slapos_cloud/ComputePartition_getInstanceUrlString',
'slapos_cloud/ComputePartition_getLastestContactedDate',
'slapos_cloud/ComputePartition_getOwnerName',
'slapos_cloud/ComputePartition_getOwnerUrl',
'slapos_cloud/ComputePartition_getRelatedImageAbsoluteUrl',
'slapos_cloud/ComputePartition_getRelatedInstanceCreationDate',
'slapos_cloud/ComputePartition_getSoftwareInstanceStatus',
'slapos_cloud/ComputePartition_getSoftwareType',
'slapos_cloud/ComputePartition_isFreeForRequest',
'slapos_cloud/ComputerNetwork_afterClone',
'slapos_cloud/ComputerNetwork_getReleatedSoftwareRelease',
'slapos_cloud/ComputerNetwork_getSoftwareInstanceAmount',
'slapos_cloud/ComputerNetwork_getSoftwareReleaseAllocableState',
'slapos_cloud/ComputerNetwork_getSoftwareReleaseUrl',
'slapos_cloud/ERP5Type_asSecurityGroupId',
'slapos_cloud/InstanceTree_getDefaultImageAbsoluteUrl',
'slapos_cloud/InstanceTree_requestDestroy',
'slapos_cloud/InstanceTree_requestStart',
'slapos_cloud/InstanceTree_requestStop',
'slapos_cloud/Organisation_afterClone',
'slapos_cloud/Organisation_init',
'slapos_cloud/Person_findPartition',
'slapos_cloud/Project_getComputeNodeReferenceList',
'slapos_cloud/Project_init',
'slapos_cloud/Resource_zGetTrackingList',
'slapos_cloud/SoftwareInstallation_requestDestruction',
'slapos_cloud/SoftwareInstance_afterClone',
'slapos_cloud/SoftwareInstance_checkPredecessorToSuccessorMigrationConsistency',
'slapos_cloud/SoftwareInstance_getComputeNodeUrl',
'slapos_cloud/SoftwareInstance_getComputePartitionIPv6',
'slapos_cloud/SoftwareInstance_getCurrentStatus',
'slapos_cloud/SoftwareInstance_getDefaultImageAbsoluteUrl',
'slapos_cloud/SoftwareInstance_getPartitionUrl',
'slapos_cloud/SoftwareInstance_init',
'slapos_cloud/SoftwareInstance_initUserId',
'slapos_cloud/SoftwareInstance_renameAndRequestStopAction',
'slapos_cloud/SoftwareRelease_getCurrentInstallationStateAsHtml',
'slapos_cloud/SoftwareRelease_getRelatedNetworkList',
'slapos_cloud/SoftwareRelease_getUsableComputeNodeList',
'slapos_cloud/SoftwareRelease_getUsableComputeNodeWithoutSInstanceList',
'slapos_cloud/SoftwareInstance_viewRenameAndRequestDestroyAction',
'slapos_cloud/Base_getSupportRequestInProgress',
'slapos_cloud/SoftwareInstance_checkDuplicationOnInstanceTreeConsistency',
'slapos_crm_monitoring/ComputeNodeModule_getComputeNodeTicketReportList',
'slapos_crm_monitoring/ComputeNodeModule_getComputeNodeTicketReportSectionList',
'slapos_crm_monitoring/ComputeNode_checkInstanceOnCloseAllocation',
'slapos_crm_monitoring/ComputeNode_getRelatedSupportRequestList',
'slapos_crm_monitoring/InstanceTreeModule_getResilienceUsageReportList',
'slapos_crm_monitoring/InstanceTreeModule_getResilienceUsageReportSectionList',
'slapos_crm_monitoring/InstanceTreeModule_getUsageReportList',
'slapos_crm_monitoring/Person_hasRequiredRole',
'slapos_crm_monitoring/SiteMessage_setSlapOSUserSourceAndDestinatationList',
'slapos_crm_monitoring/SupportRequestModule_exportMonitoringOPMLDescriptionList',
'slapos_crm_monitoring/SupportRequestModule_getInstanceMessageList',
'slapos_crm_monitoring/SupportRequestModule_getMonitoringOPMLDescriptionList',
'slapos_crm_monitoring/SupportRequest_getInstanceMessageList',
'slapos_crm_monitoring/SupportRequest_getInstanceMonitorUrl',
'slapos_crm_monitoring/SupportRequest_getMonitorUrl',
'slapos_crm_monitoring/SupportRequest_recheckMonitoring',
'slapos_crm_monitoring/Event_checkCustomerAsSourceOrDestinationConsistency',
'slapos_crm_monitoring/SupportRequest_checkCausalitySourceDestinationConsistency',
'slapos_crm_monitoring/SupportRequest_getLastEvent',
'slapos_crm/Person_getSubscriptionRequestFirstUnpaidPaymentList',
'slapos_crm/RegularisationRequest_afterClone',
'slapos_crm/RegularisationRequest_getResourceItemList',
'slapos_crm/RegularisationRequest_init',
'slapos_pdm/InstanceTree_getUpgradeSubscriptionRelatedValue',
'slapos_pdm/UpgradeDecision_afterClone',
'slapos_pdm/UpgradeDecision_getResourceItemList',
'slapos_pdm/UpgradeDecision_init',
'slapos_contract/CloudContractLine_getRemainingInvoiceCredit',
'slapos_simulation/DeliveryBuilder_selectSlapOSConfirmedInvoiceList',
'slapos_simulation/DeliveryBuilder_selectSlapOSMovement',
'slapos_simulation/InstanceTree_getRuleReference',
'slapos_simulation/PackingList_getRuleReference',
'slapos_simulation/PaymentTransaction_getRuleReference',
'slapos_simulation/SaleInvoiceTransaction_postSlapOSGeneration',
'slapos_simulation/SaleInvoiceTransaction_postSlapOSSaleInvoiceTransactionLineGeneration',
'slapos_simulation/SaleInvoiceTransaction_selectSlapOSDelivery',
'slapos_simulation/SalePackingList_postSlapOSGeneration',
'slapos_simulation/SimulationMovement_removeBogusDeliveryLink',
'slapos_simulation/SimulationMovement_testCommonRule',
'slapos_simulation/SimulationMovement_testInvoiceSimulationRule',
'slapos_simulation/SimulationMovement_testInvoiceTransactionSimulationRule',
'slapos_simulation/SimulationMovement_testPaymentSimulationRule',
'slapos_simulation/SimulationMovement_testTradeModelSimulationRule',
'slapos_accounting/Base_testSlapOSValidTradeCondition',
'slapos_accounting/ERP5Site_zGetOpenOrderWithModifiedLineUid',
'slapos_accounting/OrderBuilder_generateSlapOSAggregatedMovementList',
'slapos_accounting/OrderBuilder_selectSlapOSAggregatedDeliveryList',
'slapos_accounting/PaymentTransaction_getExternalPaymentId',
'slapos_accounting/PaymentTransaction_postOrderBuild',
'slapos_accounting/Person_getAggregatedDelivery',
'slapos_accounting/Person_setAggregatedDelivery',
'slapos_accounting/SaleInvoiceTransaction_init',
'slapos_accounting/SaleInvoiceTransaction_isTotalPriceEqualAccounting',
'slapos_accounting/SaleInvoiceTransaction_isTotalPriceMatchingSalePackingList',
'slapos_accounting/SaleInvoiceTransaction_isTradeModelCorrect',
'slapos_accounting/SalePackingList_jumpToRelatedAggregatedSalePackingList',
'slapos_accounting/SalePackingList_jumpToRelatedGroupedSalePackingList',
'slapos_accounting/SalePackingList_postSlapOSAggregatedDeliveryBuilder',
'slapos_accounting/SubscriptionRequest_getAggregatedConsumptionDelivery',
'slapos_accounting/SubscriptionRequest_setAggregatedConsumptionDelivery',
'slapos_consumption/Base_getConsumptionListAsODSReport',
'slapos_consumption/Base_getResourceServiceTitleUitList',
'slapos_consumption/Base_getUserConsumptionDetailList',
'slapos_consumption/Base_jumpToViewLatestDayConsumption',
'slapos_consumption/ComputeNode_getLatestCPUPercentLoad',
'slapos_consumption/ComputeNode_getWattConsumption',
'slapos_consumption/ComputeNode_getZeroEmissionRatio',
'slapos_consumption/InstanceTree_getCPUStat',
'slapos_consumption/InstanceTree_getDiskStat',
'slapos_consumption/InstanceTree_getEcoReallocationInformation',
'slapos_consumption/InstanceTree_getMemoryStat',
'slapos_consumption/InstanceTree_getMostEcoEfficientSoftwareInstance',
'slapos_consumption/InstanceTree_getResourceConsumptionDetailList',
'slapos_consumption/InstanceTree_getStatForResource',
'slapos_consumption/SaleInvoiceTransaction_generateResourceConsumptionDocument',
'slapos_consumption/SoftwareInstance_getAverageCPULoad',
'slapos_consumption/SoftwareInstance_getCurrentDeltaCO2',
'slapos_consumption/SoftwareInstance_getFutureDeltaCO2',
'slapos_consumption/SoftwareInstance_getLatestCPUPercentLoad',
'slapos_consumption/SoftwareInstance_getResilientMasterNode',
'slapos_consumption/SoftwareInstance_getWattStats',
'slapos_consumption/SoftwareRelease_getAverageConsumedCPULoad',
'slapos_consumption/SoftwareRelease_getAverageConsumedMemory',
'slapos_consumption/SoftwareRelease_getDeltaCO2List',
'slapos_consumption/SoftwareRelease_updateCapacityQuantity',
'slapos_wechat/Base_queryWechatOrderStatusByTradeNo',
'slapos_wechat/ERP5Site_receiveWechatPaymentCallback',
'slapos_wechat/PaymentTransaction_redirectToWechatPayment',
'slapos_payzen/PayzenEvent_isPaymentExpired',
'slapos_deploy_theme/WebPage_getDeploySubstitutionMappingDict',
'slapos_deploy_theme/WebPage_viewAsWeb',
'slapos_deploy_theme/WebSection_getDocumentValue',
'slapos_deploy_theme/WebSection_renderDefaultPageAsDeployScript',
'slapos_ecoallocation/ComputerConsumptionTioXMLFile_solveInvoicingGenerationEco',
'slapos_ecoallocation/Person_findPartitionEcoAllocation',
'slapos_upgrader/Base_getUpgradeBusinessTemplateList',
'slapos_upgrader/ERP5Site_upgradeERP5CoreBusinessTemplate',
'slapos_upgrader/ERP5Site_upgradeSlapOSTestUICoreBusinessTemplate',
'slapos_upgrader/ERP5Site_upgradeUpgraderBusinessTemplate',
'slapos_rss_style/Base_getTicketUrl',
'slapos_rss_style/SaleInvoiceTransaction_getRSSDescription',
'slapos_rss_style/SaleInvoiceTransaction_getRSSTitle',
'slapos_rss_style/Ticket_getRSSGuid',
'slapos_rss_style/WebSection_getLegacyMessageList',
'slapos_rss_style/WebSection_getUserCriticalTicketList',
'slapos_rss_style/WebSection_getUserTicketList',
'slapos_subscription_request/Person_applyContractInvitation',
'slapos_subscription_request/SubscriptionRequestModule_notifyActiveSubscriberList',
'slapos_subscription_request/SubscriptionRequest_checkRelatedAccounting',
'slapos_subscription_request/SubscriptionRequest_generateReservationRefoundSalePackingList',
'slapos_subscription_request/SubscriptionRequest_getRSSDescription',
'slapos_subscription_request/SubscriptionRequest_getRelatedAccountingTransactionList',
'slapos_subscription_request/SubscriptionRequest_notifyPaymentIsReady',
'slapos_subscription_request/SubscriptionRequest_processStopped',
'slapos_subscription_request/SubscriptionRequest_testSkippedReservationFree',
'slapos_hal_json_style/AccountingTransaction_getPaymentStateAsHateoas',
'slapos_hal_json_style/AcknowledgementTool_getUserUnreadAcknowledgementValueList',
'slapos_hal_json_style/Base_getComputerToken',
'slapos_hal_json_style/Base_getContextualHelpList',
'slapos_hal_json_style/Base_getCriticalFeedUrl',
'slapos_hal_json_style/Base_getFeedUrl',
'slapos_hal_json_style/Base_getInvitationLink',
'slapos_hal_json_style/Base_getNewsDictFromComputeNodeList',
'slapos_hal_json_style/Base_getOpenComputeNodeList',
'slapos_hal_json_style/Category_getCategoryChildTranslatedCompactTitleItemListAsJSON',
'slapos_hal_json_style/Document_getNewsDict',
'slapos_hal_json_style/ERP5Site_callbackFacebookLogin',
'slapos_hal_json_style/ERP5Site_receiveGoogleCallback',
'slapos_hal_json_style/Event_getAcknowledgementDict',
'slapos_hal_json_style/InstanceTree_getConnectionParameterList',
'slapos_hal_json_style/InstanceTree_getMonitorParameterDict',
'slapos_hal_json_style/Item_getCurrentProjectTitle',
'slapos_hal_json_style/Item_getCurrentSiteTitle',
'slapos_hal_json_style/Login_edit',
'slapos_hal_json_style/Organisation_acceptInvitation',
'slapos_hal_json_style/Organisation_closeRelatedAssignment',
'slapos_hal_json_style/Organisation_getAssociatedPersonList',
'slapos_hal_json_style/Organisation_hasItem',
'slapos_hal_json_style/PasswordTool_changeUserPassword',
'slapos_hal_json_style/PaymentTransaction_redirectToManualFreePayment',
'slapos_hal_json_style/PaymentTransaction_redirectToManualSlapOSPayment',
'slapos_hal_json_style/Person_getAssignmentDestinationList',
'slapos_hal_json_style/Person_getCloudContractRelated',
'slapos_hal_json_style/Person_requestComputeNode',
'slapos_hal_json_style/Person_requestHateoasInstanceTree',
'slapos_hal_json_style/Person_requestSupport',
'slapos_hal_json_style/Project_acceptInvitation',
'slapos_hal_json_style/Project_closeRelatedAssignment',
'slapos_hal_json_style/Project_hasItem',
'slapos_hal_json_style/SaleInvoiceTransaction_getRelatedInstanceTreeReportLineList',
'slapos_hal_json_style/SaleInvoiceTransaction_getRelatedPaymentTransactionIntegrationId',
'slapos_hal_json_style/SoftwareInstallation_getSoftwareReleaseInformation',
'slapos_hal_json_style/SoftwareInstance_getReportedState',
'slapos_hal_json_style/SoftwareProduct_getSoftwareReleaseAsHateoas',
'slapos_hal_json_style/SoftwareRelease_requestInstanceTree',
'slapos_hal_json_style/SoftwareRelease_requestSoftwareInstallation',
'slapos_hal_json_style/SupportRequest_close',
'slapos_hal_json_style/Ticket_getResourceItemListAsJSON',
'slapos_hal_json_style/WebSection_getDocumentValue',
'slapos_hal_json_style/WebSection_getLoginWarningMessage',
'slapos_hal_json_style/Ticket_requestEvent',
'slapos_hal_json_style/ComputerNetwork_getComputeNodeList',
'slapos_hal_json_style/Base_getStatusMonitorUrl',
'slapos_administration/ActivityTool_getDateForActivityMessage',
'slapos_administration/ActivityTool_zGetDateForSQLDictMessage',
'slapos_administration/ActivityTool_zGetDateForSQLQueueMessage',
'slapos_administration/Base_checkStoredBrokenState',
'slapos_administration/ERP5Site_adjustProductionClone',
'slapos_administration/ERP5Site_assertDumpedConfiguration',
'slapos_administration/ERP5Site_cleanUnusedSecurityUid',
'slapos_administration/ERP5Site_getSecurityUidStat',
'slapos_administration/ERP5Site_updateAllLocalRolesOnSecurityGroupsForSlapOS',
'slapos_administration/NotificationMessageModule_updateProductionNotificationId',
'slapos_administration/TemplateTool_deleteObsoleteTemplateList',
'slapos_administration/TemplateTool_unindexDeletedObjectList',
'slapos_administration/WebPage_updateGadgetId',
'slapos_administration/z_delete_security_uid_set_from_roles_and_users',
'slapos_administration/z_get_used_computer_security_uid_list',
'slapos_administration/z_get_used_group_security_uid_list',
'slapos_administration/z_get_used_organisation_security_uid_list',
'slapos_administration/z_get_used_project_security_uid_list',
'slapos_administration/z_get_used_security_uid_list',
'slapos_administration/z_get_used_shadow_security_uid_list',
'slapos_administration/z_get_used_subscription_security_uid_list',
'slapos_administration/z_get_used_user_security_uid_list',
'slapos_administration/z_refresh_roles_and_users',
'slapos_administration/z_search_unindexed_security_uid',
'slapos_administration/SoftwareInstance_renewCertificate',
'slapos_core/Base_updateSlapOSLocalRolesOnSecurityGroups',
'slapos_core/ComputeNode_getSecurityCategoryFromAllocationScope',
'slapos_core/ComputePartition_getSecurityCategoryFromUser',
'slapos_core/ERP5Type_acquireSecurityFromOwner',
'slapos_core/ERP5Type_getSecurityCategoryFromAggregateRelatedSoftwareInstanceInstanceTree',
'slapos_core/ERP5Type_getSecurityCategoryFromChildAssignmentList',
'slapos_core/ERP5Type_getSecurityCategoryFromContentParent',
'slapos_core/ERP5Type_getSecurityCategoryFromParent',
'slapos_core/ERP5Type_getSecurityCategoryMapping',
'slapos_core/Event_getSecurityCategoryFromMovementFollowUpAggregateComputeNodeDestinationSection',
'slapos_core/Event_getSecurityCategoryFromMovementFollowUpAggregateDestination',
'slapos_core/Event_getSecurityCategoryFromMovementFollowUpAggregateDestinationProject',
'slapos_core/Item_getSecurityCategoryFromMovementAggregateComputeNodeDestinationSection',
'slapos_core/Item_getSecurityCategoryFromMovementAggregateDestination',
'slapos_core/Item_getSecurityCategoryFromMovementAggregateDestinationProject',
'slapos_core/Item_getSecurityCategoryFromMovementAggregateDestinationSection',
'slapos_core/Item_getSecurityCategoryFromMovementDestination',
'slapos_core/Item_getSecurityCategoryFromMovementDestinationProject',
'slapos_core/Item_getSecurityCategoryFromMovementDestinationSection',
'slapos_core/Item_getSecurityCategoryFromMovementLineAggregateComputeNodeDestinationSection',
'slapos_core/Item_getSecurityCategoryFromMovementLineAggregateDestination',
'slapos_core/Item_getSecurityCategoryFromMovementLineAggregateDestinationProject',
'slapos_core/PaymentTransaction_getSecurityCategoryFromUser',
'slapos_core/PayzenEvent_getSecurityCategoryFromUser',
'slapos_core/Person_getSecurityCategoryFromSelfShadow',
'slapos_core/SlaveInstance_getSecurityCategoryFromSoftwareInstance',
'slapos_core/SoftwareInstance_getSecurityCategoryFromMovementSpecialiseDestination',
'slapos_core/SoftwareInstance_getSecurityCategoryFromMovementSpecialiseDestinationProject',
'slapos_core/SoftwareInstance_getSecurityCategoryFromUser',
'slapos_disaster_recovery/ERP5Site_checkDeletedDocumentList',
'slapos_disaster_recovery/ERP5Site_checkLatestModifiedDocumentList',
'slapos_disaster_recovery/ERP5Site_recoverFromRestoration',
'slapos_disaster_recovery/ERP5Site_reindexOrUnindexDocumentList',
'slapos_disaster_recovery/ERP5Site_unindexDeletedDocumentList',
'slapos_base/Base_acceptContractInvitation',
'slapos_base/ERP5Login_isLoginBlocked',
'slapos_base/ERP5Login_isPasswordExpired',
'slapos_base/Login_getFastExpirationReferenceList',
'slapos_base/Login_isLoginBlocked',
'slapos_base/Login_isPasswordExpired',
'slapos_base/Login_notifyPasswordExpire',
'slapos_base/Person_applyContractInvitation',
'slapos_base/ERP5Site_getAvailableOAuthLoginList',
'slapos_base/WebSection_getHostingJSPrecacheManifestList',
'slapos_erp5/CatalogTool_checkNoneCreationDateConsistency',
'slapos_erp5/CertificateAuthorityTool_checkCertificateAuthorityConsistency',
'slapos_erp5/CertificateAuthorityTool_checkSlapOSMachineNonExistenceConsistency',
'slapos_erp5/CertificateAuthorityTool_checkSlapOSPASConsistency',
'slapos_erp5/MemcachedTool_checkKumofsServerConstraint',
'slapos_erp5/MemcachedTool_checkMemcachedServerConsistency',
'slapos_erp5/Module_checkSlapOSModuleIdGeneratorConsistency',
'slapos_erp5/OAuthTool_checkFacebookConnectorExistenceConsistency',
'slapos_erp5/OAuthTool_checkGoogleConnectorExistenceConsistency',
'slapos_erp5/WebSiteModule_checkShacacheConstraint',
'slapos_erp5/SystemPreference_checkConversionServerConsistency',
'slapos_erp5/SystemPreference_checkSystemPreferenceConsistency']
SlapOSTestCaseMixin.afterSetUp(self) SlapOSTestCaseMixin.afterSetUp(self)
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
...@@ -67,6 +378,52 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template): ...@@ -67,6 +378,52 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template):
# we define it for CodingStyleTestCase.test_PythonSourceCode # we define it for CodingStyleTestCase.test_PythonSourceCode
return ('erp5_administration', ) return ('erp5_administration', )
def test_PythonScriptTestCoverage(self):
content_dict = {}
for test_component in self.portal.portal_components.searchFolder(
portal_type='Test Component'):
if "Slap" not in test_component.getId() or \
"testSlapOSCodingStyle" in test_component.getId():
continue
content_dict[test_component.getId()] = test_component.getTextContent()
self.assertNotEqual(len(content_dict), 0)
skin_id_set = set()
for business_template in self._getTestedBusinessTemplateValueList():
skin_id_set.update(business_template.getTemplateSkinIdList())
# Init message list
message_list = []
# Test skins
portal_skins = self.portal.portal_skins
for skin_id in skin_id_set:
skin = portal_skins[skin_id]
for _, document in skin.ZopeFind(
skin,
obj_metatypes=('Script (Python)', 'Z SQL Method', ),
search_sub=True):
if document.getId().startswith("Alarm_"):
# Alarms are tested directly, so we can safely skip
continue
found = 0
for _, content in content_dict.iteritems():
if document.getId() in content:
found = 1
break
document_path = "%s/%s" % (skin.getId(), document.getId())
if not found and document_path not in self.coverage_ignore_path_list:
message_list.append(document_path)
if found and document_path in self.coverage_ignore_path_list:
message_list.append("Remove %s from coverage_ignore_path_list" % document_path)
self.maxDiff = None
self.assertEqual(message_list, [])
return type("TestSlapOSCodingStyle.%s" % tested_business_template, return type("TestSlapOSCodingStyle.%s" % tested_business_template,
(TestSlapOSCodingStyle,), (TestSlapOSCodingStyle,),
{"getTestedBusinessTemplateList": lambda self: (tested_business_template, )}) {"getTestedBusinessTemplateList": lambda self: (tested_business_template, )})
......
...@@ -6,12 +6,6 @@ ...@@ -6,12 +6,6 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testSlapOSCodingStyle</string> </value> <value> <string>testSlapOSCodingStyle</string> </value>
...@@ -55,28 +49,13 @@ ...@@ -55,28 +49,13 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -89,7 +68,7 @@ ...@@ -89,7 +68,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -98,7 +77,7 @@ ...@@ -98,7 +77,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="4" aka="AAAAAAAAAAQ="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
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