Index: openacs-4/contrib/packages/simulation/test/demo-data-setup.test =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/test/Attic/demo-data-setup.test,v diff -u -N -r1.15 -r1.16 --- openacs-4/contrib/packages/simulation/test/demo-data-setup.test 7 Jan 2004 13:46:48 -0000 1.15 +++ openacs-4/contrib/packages/simulation/test/demo-data-setup.test 7 Jan 2004 16:16:06 -0000 1.16 @@ -9,88 +9,7 @@ global __demo_users_password set __demo_users_password 1 - # Demo data start - set actors_list { - Teacher - Student - Agent1 - Agent2 - } - array set characters { - Bernadette "Bernadette" - MOTORHOME "MOTORHOME" - "A of Lawfirm X" "Her lawyer" - "A of Lawfirm Y" "Its lawyer" - "B of Lawfirm X" "Partner firm X" - "B of Lawfirm Y" "Partner firm Y" - "C of Lawfirm X" "Secretary firm X" - "C of Lawfirm Y" "Secretary firm Y" - "Portal" "Library" - "Lok of Legisl. Dept." "Member 1 of Legisl. Dept." - "Peter of Legisl. Dept." "Member 2 of Legisl. Dept." - "Aernout of Legisl. Dept." "Head of Legisl. Dept." - "Jeroen of Legisl. Dept." "Deputy Head of Legisl. Dept." - "Laurens of Legisl. Dept." "Chief of Legisl. Dept." - "Fred Undraiser" "Fundraiser" - "A of ADC" "Representative of ADC" - "Minister" "Minister of Justice" - "General Student" "Student" - } - array set characters_ld { - "Lok of Legisl. Dept." "Member 1 of Legisl. Dept." - "Peter of Legisl. Dept." "Member 2 of Legisl. Dept." - "Aernout of Legisl. Dept." "Head of Legisl. Dept." - "Jeroen of Legisl. Dept." "Deputy Head of Legisl. Dept." - "Laurens of Legisl. Dept." "Chief of Legisl. Dept." - "Fred Undraiser" "Fundraiser" - "A of ADC" "Representative of ADC" - "Minister" "Minister of Justice" - "General Student" "Student" - } - array set properties { - "Demo Property 1" "Demo Property 1" - "Demo Property 2" "Demo Property 2" - } - array set tasks { - "Ask information from Bernadette" {assigned_role "Her lawyer" recipient_role "Bernadette"} - "Ask information from MOTORHOME" {assigned_role "Her lawyer" recipient_role "MOTORHOME"} - "Ask information from opponent's lawyer 1" {assigned_role "Its lawyer" recipient_role "Her lawyer"} - "Ask information from opponent's lawyer 2" {assigned_role "Her lawyer" recipient_role "Its lawyer"} - "Ask information from library" {assigned_role "Her lawyer" recipient_role "Library"} - "Ask information from partner" {assigned_role "Her lawyer" recipient_role "Partner firm X"} - "Intervene" {assigned_role "Partner firm X" recipient_role "Her lawyer"} - "Reply to intervention" {assigned_role "Her lawyer" recipient_role "Partner firm X"} - "Give information as Bernadette" {assigned_role "Bernadette" recipient_role "Her lawyer"} - "Give information as Motorhome" {assigned_role "MOTORHOME" recipient_role "Her lawyer"} - "Make/edit draft report" {assigned_role "Her lawyer" recipient_role "Her lawyer"} - "Edit draft report" {assigned_role "Her lawyer" recipient_role "Her lawyer"} - "Give information to opponent's lawyer" {assigned_role "Her lawyer" recipient_role "Its lawyer"} - "Send final report" {assigned_role "Her lawyer" recipient_role "Partner firm X"} - "Send draft report" {assigned_role "Her lawyer" recipient_role "Partner firm X"} - } - array set tasks_ld { - "Write Proposal gr1" {assigned_role "Member 1 of Legisl. Dept." recipient_role "Head of Legisl. Dept."} - "Write Proposal gr2" {assigned_role "Member 2 of Legisl. Dept." recipient_role "Deputy Head of Legisl. Dept."} - "Write Opinion SHOULD BE AN ADDINFOTOPORTFOLIO gr1" {assigned_role "Fundraiser" recipient_role "Minister of Justice"} - "Write Opinion SHOULD BE AN ADDINFOTOPORTFOLIO gr2" {assigned_role "Representative of ADC" recipient_role "Minister of Justice"} - "Comment on Member2 Proposal SHOULD BE AN ADDINFOTOPORTFOLIO" {assigned_role "Head of Legisl. Dept." recipient_role "Minister of Justice"} - "Comment on Member1 Proposal SHOULD BE AN ADDINFOTOPORTFOLIO" {assigned_role "Deputy Head of Legisl. Dept." recipient_role "Minister of Justice"} - "Revise using Opinions and Comment from Head SHOULD BE AN ADDINFOTOPORTFOLIO" {assigned_role "Member 1 of Legisl. Dept." recipient_role "Minister of Justice"} - "Revise using Opinions and Comment from Deputy SHOULD BE AN ADDINFOTOPORTFOLIO" {assigned_role "Member 2 of Legisl. Dept." recipient_role "Minister of Justice"} - "Rate Comments SHOULD BE A REVIEWINFO" {assigned_role "Student" recipient_role "Minister of Justice"} - "Rate Revisions SHOULD BE A REVIEWINFO" {assigned_role "Student" recipient_role "Minister of Justice"} - "Learning evaluation DUMMY or ADDINFOTOPORTFOLIO" {assigned_role "Student" recipient_role "Minister of Justice"} - "Write Definition based on Revision SHOULD BE AN ADDINFOTOPORTFOLIO" {assigned_role "Member 1 of Legisl. Dept." recipient_role "Minister of Justice"} - "Elaborate the Revision SHOULD BE AN ADDINFOTOPORTFOLIO" {assigned_role "Member 2 of Legisl. Dept." recipient_role "Minister of Justice"} - "Comment Revision of Member 1" {assigned_role "Head of Legisl. Dept." recipient_role "Minister of Justice"} - "Comment Revision of Member 2" {assigned_role "Deputy Head of Legisl. Dept." recipient_role "Minister of Justice"} - "Learning Evalution SHOULD BE A ADDINFOTOPORTFOLIO" {assigned_role "Student" recipient_role "Minister of Justice"} - "Implementation of all received comments and opinions SHOULD BE AN ADDINFOTOPORTFOLIO gr1" {assigned_role "Member 2 of Legisl. Dept." recipient_role "Minister of Justice"} - "Implementation of all received comments and opinions SHOULD BE AN ADDINFOTOPORTFOLIO gr2" {assigned_role "Member 2 of Legisl. Dept." recipient_role "Minister of Justice"} - "Write law SHOULD BE AN ADDINFOTOPORTFOLIO gr1" {assigned_role "Member 1 of Legisl. Dept." recipient_role "Minister of Justice"} - "Write law SHOULD BE AN ADDINFOTOPORTFOLIO gr2" {assigned_role "Member 1 of Legisl. Dept." recipient_role "Minister of Justice"} - } - # Demo data end + source demo-data.tcl ::twt::log_section "Login the site wide admin" ::twt::user::login_site_wide_admin @@ -135,8 +54,8 @@ "City Admins" "Actors" } { - set first_names $group_name - set last_name "Test User" + set first_names [::twt::simulation::permission_user_first_names $group_name] + set last_name [::twt::simulation::permission_user_last_name $group_name] ::twt::simulation::add_user -first_names $first_names -last_name $last_name ::twt::simulation::add_user_to_group -group_name $group_name -user_name "$first_names $last_name" @@ -148,6 +67,9 @@ # ################################### + # Do this as the city build user to make sure he has sufficient permissions + ::twt::user::login [::twt::simulation::permission_user_email "City Admins"] + ::twt::log_section "Create an image object" do_request /simulation/citybuild link follow ~u object-edit @@ -186,6 +108,9 @@ # ################################### + # TODO: do this is as "Template Authors" test user + ::twt::user::login_site_wide_admin + set template_name "Elementary Private Law" ::twt::log_section "Create $template_name simulation template" ::twt::simulation::add_template -template_name $template_name @@ -265,16 +190,45 @@ # ################################### + set group_name "City Admins" + # login user + ::twt::user::login [::twt::simulation::permission_user_email $group_name] # city admin can access index page + ::twt::simulation::assert_page_accessible /simulation # can access citybuild - # can create/edit/delete object - # SPECIAL: can set the on_map_p attribute - - # can't access any of the other three modules + ::twt::simulation::assert_page_accessible /simulation/citybuild + # can create object + set object_title "Test property" + ::twt::simulation::add_object -type sim_prop -title $object_title + + # can edit on_map_p attribute of object + do_request /simulation/citybuild + link follow ~c $object_title + link follow ~u object-edit + regexp {item%5fid=([0-9]+)} [response url] match item_id + form find ~n object + field find ~n attr__sim_prop__on_map_p + field select2 ~v t + form submit + if { [regexp "Permission Denied" [response body]] } { + error "City admin should not get permission denied when editing on_map_p of an object" + } + + # can delete object + do_request "/simulation/citybuild/object-delete?confirm_p=1&item_id=$item_id" + if { [regexp "Permission Denied" [response body]] } { + error "City admin should not get permission denied when deleting an object" + } + + # can not build or instantiate templates + foreach module {simbuild siminst} { + ::twt::simulation::assert_page_not_accessible /simulation/$module + } + ################################### # # Permission testing with sim admin (simulation super user)