Commit 0f9a98d1 authored by Sebastien Robin's avatar Sebastien Robin

first submission

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2735 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0468dd66
master allow_login_change allow_login_change_wip arnau arnau-TM-FEC-output arnau-TM-getTypeBasedMethod-for-init_script arnau-TM-isBuildable-with-multiple-BusinessLinks arnau-TM-jabber-client-desktop-notifications arnau-kns arnau-kns-without-property-mapping arnau-merge arnau-poc arnau-real-time-inventory-accounting auto_extend_select_list autoflake backup_erp5_workflow bk_erp5ish_actions_tool bk_sqlcatalog boc-interaction-drop bryton/py3 bt5_config cache callable-jupyter-storage catalog_filter catalog_fulltext catalog_fulltext_old cedric cedriclen cedriclen-eos certificate_authority cherry-pick-243c2f03 cherry-pick-304d7a28 cherry-pick-4a8e045d cleanJSByJSLint clean_up_upgrader cleanup_acquisition_base_category compact_title_no_reference credential_update_action datetimefield deferred_listbox delete_button delivery_item_barcode douglas_forum dream_distributor dsn-phase3 eos-dev erp5-component erp5-forum erp5-imt erp5-messenger erp5-preference erp5-release erp5-slapos-upgrade erp5-util-testing erp5-vifib erp5-vifib-cleanup erp5_calendar erp5_catalog erp5_catalog_final erp5_corporate_identity erp5_free_subscription erp5_hal_json_style_fix_restricted_access_with_traverse erp5_payslip_migration erp5_workflow erp5testnode_max_timeout experiment/coding_style_test_suite feat/olapy feat/pdm_content_translation feature/accounting-reports-stats feature/hal-actions-support feature/hal-support-update feature/jio-accounting-reports feature/jio-action-accounting feature/jio-selection-actions feature/json-allows-all-jio-actions feature/renderjs-matrixbox feature/renderjs-ui-no-header feature/rjs-listbox-stats feature/rjs-mass-transition feature/rjs-print-action fix/consistency_check_alarm fix/login_validate_check_consistency fix/multiple_small_fixes_to_zodb_history_tab fix/support-request-app-empty fix_system_processes_ownership for_testrunner_1 for_testrunner_2 for_testrunner_3 gabriel gabriel-fix-rounding-in-accounting-generation gabriel-fix-rounding-in-accounting-generation2 gadget-json-value hamza-backup hotfix/accounting-test-timeout hotfix/callable_tool hotfix/field-keeps-request hotfix/jio-mass-transition hotfix/jio_view hotfix/pdm-test hotfix/rjs-accounting-tests hotfix/rjs-editability hotfix/rjs-form-less-invasive hotfix/rjs-formfields-padding hotfix/rjs-listbox-mutex hotfix/rjs-replace-query-with-uids hotfix/tests-cleanup http_cache_fix improve_default_caching_policy_manager initsite interaction-drop isDeletable item_tracking_graph_editor ivan jerome-bt-reference-doc jerome_graph_editor_renderjs jerome_new_style_solve_divergence jerome_user_preference_time_zone jio jm/form-action-guard joblib-activity js-ui keep_order_in_set_type_category_accessor kns lazy_simulation_causality lignan lingnan listbox-generator listbox_url macros_fix mame mame-bt5-cleanup mame-erp5_project-cleanup mame-naming-convention mame-naming-convention-list_method mame-test-stock-indexation mame-work mame2 maste_copy master-erp5-test-result-scalability master-erp5-test-result-scalability-rebase master-test-fix-additionalbt5path master_calendar_wip_patches master_calendar_wip_patches_extend_security master_no_guard_on_workflow_transition master_no_guard_on_workflow_transition_plus_calendar_wip_patchs mic_wind mmariani-inventory monitoring monitoring-graph mrp new-render-presentation new_new_hamza_master no_longer_simulated_state officejs officejs_clean officejs_zip ojs_wip pere portal_callables portal_solver_process_security_configuration presentation rebased_mrp refactor/base_edit refactor/renderjs reindex_calendar_after_change_calendar_exception revert-38554dbe revert-6c89fe9b rewrite_test_21_AcquiredPortalType romain-fulltext scalability-master scalability-master2 scalability-master2-rebase scalability-roque scalability-roque-2 scalability-run-command shop-box sms_more_than_140_characters streaming_fix streaming_fix-0 strict_catalog syncml taskdistribution-xmlrpc-binary test_page testnode_software_link timezones tmp/getInstalledBusinessTemplate_never_installed_bt tristan tristan-merge tristan-performance ttrm upgradeSite valentin_translation_fix view-aggregated-amounts vivekpab_renderjs_interfaces wenjie wenjie_branch wip wsgi-gevent yryr yryr-components-cp yryr-inventory-cache yryr-test yryr-with-components yusei test-ui test-rjsacc test-rjs renderjs-test erp5.util-0.4.58 erp5.util-0.4.57 erp5.util-0.4.56 erp5.util-0.4.55 erp5.util-0.4.54 erp5.util-0.4.53 erp5.util-0.4.52 erp5.util-0.4.49 erp5.util-0.4.46 erp5.util-0.4.44 erp5.util-0.4.43 erp5.util-0.4.41 erp5.util-0.4.40 erp5.util-0.4.37 erp5.util-0.4.1 erp5.util-0.4 erp5.util-0.3 erp5.util-0.2 erp5.util-0.1
No related merge requests found
##############################################################################
#
# Copyright (c) 2004 Nexedi SARL and Contributors. All Rights Reserved.
# Sebastien Robin <seb@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.
#
##############################################################################
#
# Skeleton ZopeTestCase
#
from random import randint
import os, sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
# Needed in order to have a log file inside the current folder
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
os.environ['EVENT_LOG_SEVERITY'] = '-300'
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager, noSecurityManager
from DateTime import DateTime
from Acquisition import aq_base, aq_inner
from zLOG import LOG
from Products.ERP5Type.DateUtils import addToDate
import time
import os
from Products.ERP5Type import product_path
from DateTime import DateTime
class Test(ERP5TypeTestCase):
"""
This is the list of test
"""
def getTitle(self):
return "ERP5Catalog"
# Different variables used for this test
run_all_test = 1
source_company_id = 'Nexedi'
destination_company_id = 'Coramy'
component_id = 'brick'
sales_order_id = '1'
quantity = 10
base_price = 0.7832
#def populate(self, quiet=1, run=1):
def afterSetUp(self, quiet=1, run=1):
self.login()
portal = self.getPortal()
catalog_tool = self.getCatalogTool()
# XXX This does not works
#catalog_tool.reindexObject(portal)
# First reindex
#LOG('afterSetup',0,'portal.portal_categories.immediateReindexObject')
#portal.portal_categories.immediateReindexObject()
#LOG('afterSetup',0,'portal.portal_simulation.immediateReindexObject')
#portal.portal_simulation.immediateReindexObject()
def login(self, username='seb',quiet=0, run=run_all_test):
uf = self.getPortal().acl_users
if getattr(uf,'seb',None) is None:
uf._doAddUser('seb', '', ['Manager'], [])
uf._addGroup('GroupA')
uf._addGroup('GroupB')
uf._doAddUser('UserA', '', ['Member'], [],groups=['GroupA'])
uf._doAddUser('UserB', '', ['Member'], [],groups=['GroupB'])
user = uf.getUserById(username).__of__(uf)
newSecurityManager(None, user)
def getSqlPathList(self):
"""
Give the full list of path in the catalog
"""
sql_connection = self.getSqlConnection()
sql = 'select path from catalog'
result = sql_connection.manage_test(sql)
path_list = map(lambda x: x['path'],result)
return path_list
def checkRelativeUrlInSqlPathList(self,url_list):
path_list = self.getSqlPathList()
portal_id = self.getPortalId()
for url in url_list:
path = '/' + portal_id + '/' + url
self.failUnless(path in path_list)
LOG('checkRelativeUrlInSqlPathList found path:',0,path)
def checkRelativeUrlNotInSqlPathList(self,url_list):
path_list = self.getSqlPathList()
portal_id = self.getPortalId()
for url in url_list:
path = '/' + portal_id + '/' + url
self.failUnless(path not in path_list)
LOG('checkRelativeUrlInSqlPathList not found path:',0,path)
def test_01_StandardSearchFolder(self, quiet=0, run=run_all_test):
# Test if portal_synchronizations was created
if not run: return
if not quiet:
ZopeTestCase._print('\nTest Standard Search Folder ')
LOG('Testing... ',0,'testStandardSearchFolder')
organisation_module = self.getOrganisationModule()
organisation_module.manage_addLocalGroupRoles('GroupA',['Author'])
organisation_module.manage_addLocalGroupRoles('GroupB',['Author'])
self.login('UserA')
organisation_module.newContent(id='A',immediate_reindex=1)
organisation_list = organisation_module.searchFolder()
self.assertEquals(len(organisation_list),1)
self.login('UserB')
organisation_list = organisation_module.searchFolder()
self.assertEquals(len(organisation_list),1)
def test_02_SearchFolderWithNegativeGroup(self, quiet=0, run=run_all_test):
# Test if portal_synchronizations was created
if not run: return
if not quiet:
ZopeTestCase._print('\nTest Search Folder With Negative Group')
LOG('Testing... ',0,'testSeachFolderWithNegativeGroup')
organisation_module = self.getOrganisationModule()
organisation_module.manage_addLocalGroupRoles('GroupA',['Author'])
organisation_module.manage_addLocalGroupRoles('GroupB',['Author'])
self.login('UserA')
organisation = organisation_module.newContent(id='A',immediate_reindex=1)
organisation_list = organisation_module.searchFolder()
self.assertEquals(len(organisation_list),1)
self.login()
organisation.manage_addLocalGroupRoles('GroupB',['-Author'])
organisation.immediateReindexObject()
self.login('UserB')
organisation_list = organisation_module.searchFolder()
self.assertEquals(len(organisation_list),0)
if __name__ == '__main__':
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(Test))
return suite
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