Index: openacs-4/packages/xowf/tcl/test/xowf-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/tcl/test/xowf-test-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/xowf/tcl/test/xowf-test-procs.tcl 21 May 2018 16:15:00 -0000 1.4 +++ openacs-4/packages/xowf/tcl/test/xowf-test-procs.tcl 23 May 2018 13:35:06 -0000 1.5 @@ -5,19 +5,20 @@ } create_folder_with_page { Create a folder in a xowf instance with a form page and edit this + } { - - # run the test under the current user_id. + # + # Run the test under the current user_id. + # set user_id [ad_conn user_id] ns_log notice USER=$user_id set instance /xowf - set testfolder testfolder - #::caldav::test::basic_setup -user_id $user_id -once -private=true + set testfolder .testfolder try { # - # Make sure we have a test folder + # Make sure we have a fresh test folder # set folder_info [::xowiki::test::require_test_folder \ -user_id $user_id \ @@ -32,7 +33,7 @@ aa_true "folder_id '$folder_id' is not 0" {$folder_id != 0} # - # Create a test page in the folder + # Create a simple form page in the folder. # ::xowiki::test::create_form_page \ -user_id $user_id \ @@ -47,7 +48,7 @@ } # - # Edit page + # Edit the form page. # ::xowiki::test::edit_form_page \ -user_id $user_id \ @@ -70,10 +71,12 @@ "::xowf::Package instproc initialize" } create_workflow_with_instance { - Create a xowf workflow and a instance in a folder + Create a xowf workflow and a instance in a folder. + } { - - # run the test under the current user_id. + # + # Run the test under the current user_id. + # set user_id [ad_conn user_id] ns_log notice USER=$user_id @@ -84,6 +87,10 @@ # # Make sure we have a test folder # + #set d [aa_http -user_id $user_id $instance/] + #set set_cookies [ns_set array [dict get $d headers]] + #aa_log set_cookies=$set_cookies + set folder_info [::xowiki::test::require_test_folder \ -user_id $user_id \ -instance $instance \ @@ -109,7 +116,7 @@

State: @wf_current_state@

} text.format text/html - form {
@_text@ @wf_current_state@  @_description@
} + form {
@_text@ @wf_current_state@ @_description@
} form.format text/html form_constraints { {wf_current_state:current_state} @@ -141,7 +148,7 @@ # Action save -roles admin Action propose -next_state proposed -proc activate {obj} { - my msg "$obj is going to state [my next_state]" + :log "$obj is going to state [:next_state]" } Action accept -next_state accepted Action reject -next_state rejected @@ -150,8 +157,8 @@ # States # - form: the form to be used in a state # - view_method: Typically "view" (default) or "edit" - #State parameter {{form "en:tip-form"} {view_method edit}} - #assigns the specified form to all states + # State parameter {{form "en:tip-form"} {view_method edit}} + # assigns the specified form to all states State parameter {{form "en:tip.form"} {extra_js 1.js}} @@ -166,8 +173,38 @@ aa_log "===== Workflow en:tip.wf created" + # + # Create an instance of the TIP workflow and save it. + # + ::xowiki::test::create_form_page \ + -user_id $user_id \ + -instance $instance \ + -path $testfolder \ + -parent_id $folder_id \ + -form_name tip.wf \ + -update { + _title "TIP 1" + _name en:tip1 + _text {Should we create a tip?} + __action_save "" + } + aa_log "===== Workflow instance tip1 created" + ns_log notice "===== Workflow instance tip1 created" + # + # Edit the workflow instance and propose the TIP (call the + # workflow action "propose") + # + ::xowiki::test::edit_form_page \ + -user_id $user_id \ + -instance $instance \ + -path $testfolder/tip1 \ + -update { + __action_propose "" + } + + } on error {errorMsg} { aa_true "Error msg: $errorMsg" 0 } finally {