Commit 8d27669a authored by Mame Coumba Sall's avatar Mame Coumba Sall

add new test to verify that assignor can rename categories

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26719 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cb81622f
master ERP5Type_no_immediate_reindexation allow_login_change allow_login_change_differentiate_id_and_login allow_login_change_wip arnau arnau-kns arnau-kns-without-property-mapping arnau-merge arnau-poc auto_extend_select_list autoflake backup_erp5_workflow bk_erp5ish_actions_tool bk_sqlcatalog boc-interaction-drop cache catalog_fulltext catalog_fulltext_old cedric cedriclen cedriclen-eos certificate_authority cherry-pick-4a8e045d ckeditor_update cleanJSByJSLint clean_up_upgrader cmfactivity compact_title_no_reference credential_update_action datetimefield deferred_listbox douglas_forum dream_distributor drop-legacy-simulation echarts_with_event echarts_wrapper eos-dev erp5-component erp5-data-notebook erp5-forum erp5-preference erp5-release erp5-slapos-upgrade erp5-util-testing erp5-vifib erp5-vifib-cleanup erp5_calendar erp5_free_subscription erp5_officejs_fixing erp5_workflow fix/accounting_period_constraint_vs_acquired_node fix/change_state_priority fix/login_validate_check_consistency fix_system_processes_ownership for_private_testrunner_1 for_testrunner_1 for_testrunner_2 formbox gabriel gabriel-fix-rounding-in-accounting-generation gabriel-fix-rounding-in-accounting-generation2 gadget-json-value http_cache_fix import_zip_package improve_default_caching_policy_manager interaction-drop isDeletable item_tracking_graph_editor ivan jerome-bt-reference-doc jerome-test jerome_events jerome_graph_editor_renderjs jerome_new_style_solve_divergence jerome_promise_in_tests jerome_user_preference_time_zone jio jm/form-action-guard joblib-activity kns kns-kr lazy_simulation_causality lignan lingnan listbox-generator mame mame-bt5-cleanup mame-erp5_project-cleanup mame-naming-convention mame-naming-convention-list_method mame-test-stock-indexation mame-work mame2 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 merge_xhtml_jquery mmariani-inventory mrp new-render-presentation nexedi-erp5-jp no_longer_simulated_state notebook_submodule notebook_submodule_backup officejs officejs_clean officejs_mixing_echarts pere portal_callables portal_solver_process_security_configuration presentation pyodide pyodide_submodule pyodide_webworker rebased_mrp reindex reindex_calendar_after_change_calendar_exception resursive_clone romain-fulltext scalability-master2 scalability-master2-rebase scalability-rebase shop-box simulation sms_more_than_140_characters strict_catalog submodule support_request support_request_1 support_request_2 support_request_3 support_request_4 support_request_update syncml test_page testnode_software_link timezones tristan tristan-merge tristan-performance ttr ttrm upgradeSite view-aggregated-amounts vivekpab_erp5webrenderjs_layoutconfig vivekpab_jabberclient vivekpab_renderjs_interfaces wenjie wenjie_branch xiaowu_newui yryr yryr-components-cp yryr-inventory-cache yryr-test yryr-with-components yusei 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
......@@ -58,7 +58,8 @@ class TestERP5Web(ERP5TypeTestCase, ZopeTestCase.Functional):
def login(self, quiet=0, run=run_all_test):
uf = self.getPortal().acl_users
uf._doAddUser(self.manager_username, self.manager_password, ['Manager'], [])
uf._doAddUser(self.manager_username, self.manager_password,
['Manager','Owner'], [])
user = uf.getUserById(self.manager_username).__of__(uf)
newSecurityManager(None, user)
......@@ -67,6 +68,7 @@ class TestERP5Web(ERP5TypeTestCase, ZopeTestCase.Functional):
Return the list of required business templates.
"""
return ('erp5_base',
'erp5_l10n_fr',
'erp5_web',
)
......@@ -862,6 +864,7 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
ZopeTestCase._print(message)
self.changeUser('admin')
site = self.portal.web_site_module.newContent(portal_type='Web Site',
id='site')
section = site.newContent(portal_type='Web Section', id='section')
......@@ -1257,7 +1260,59 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
category_4_clone = category_3[category_3.manage_pasteObjects(
category_4_copy)[0]['new_id']]
self.assertEquals(category_4_clone.getPortalType(), 'Category')
def test_08_createAndrenameCategory(self, quiet=quiet, run=run_all_test):
""" Test to create or rename categories with many users """
if not run: return
if not quiet:
message = '\ntest_08_createAndrenameCategory'
ZopeTestCase._print(message)
self.changeUser('admin')
portal_categories = self.portal.portal_categories
publication_section = portal_categories.publication_section
# test for admin
try:
new_base_category_1 = portal_categories.newContent(portal_type='Base Category', id='new_base_category_1')
except Unauthorized:
self.fail("Admin should be able to create a Base Category.")
try:
new_category_1 = publication_section.newContent(portal_type='Category', id='new_category_1')
new_category_2 = new_category_1.newContent(portal_type='Category',
id='new_category_2')
except Unauthorized:
self.fail("Admin should be able to create a Category.")
get_transaction().commit()
self.tic()
try:
new_cat_1_renamed = new_category_1.edit(id='new_cat_1_renamed')
new_cat_2_renamed = new_category_2.edit(id='new_cat_2_renamed')
except Unauthorized:
self.fail("Admin should be able to rename a Category.")
# test as a web user (assignor)
self.changeUser('webmaster')
try:
base_category_2 = portal_categories.newContent(portal_type='Base Category', id='base_category_2')
self.fail("A webmaster should not be able to create a Base Category.")
except Unauthorized:
pass
try:
new_category_3 = publication_section.newContent(
portal_type='Category',id='new_category_3')
new_category_4 = new_category_3.newContent(portal_type='Category',
id='new_category_4')
except Unauthorized:
self.fail("A webmaster should be able to create a Category.")
get_transaction().commit()
self.tic()
try:
new_cat_3_renamed = new_category_3.edit(id='new_cat_3_renamed')
new_cat_4_renamed = new_category_4.edit(id='new_cat_4_renamed')
except Unauthorized:
self.fail("A webmaster should be able to rename a Category.")
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestERP5Web))
......
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