acs::test::form_reply (public)
acs::test::form_reply [ -user_id user_id ] \ [ -last_request last_request ] [ -form form ] [ -url url ] \ [ -update update ] [ -remove remove ] [ form_content ]
Defined in packages/acs-automated-testing/tcl/aa-test-procs.tcl
Send a (POST) request to the specified URL based on the provided form_content which has the form of a dict. For convenience the update fields are provided to overload the form_content.
- Switches:
- -user_id (optional, defaults to
"0"
)- -last_request (optional)
- pass optionally the past request, from which cookie and login-info can be taken
- -form (optional)
- -url (optional)
- -update (optional)
- key/attribute list of values to be updated in the form content
- -remove (optional)
- keys to be removed from the form content
- Parameters:
- form_content (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- fs_add_file_to_folder, create_folder_with_page, create_form_with_form_instance
Source code: if {$form_content eq ""} { set form_content [form_get_fields $form] aa_log "FORM-CONTENT from FORM '$form_content'" } if {$form_content eq ""} { error "either nonempty form or form_content has to be provided" } if {$url eq ""} { set url [dict get $form @action] } if {$url eq ""} { error "either form with action fields or URL has to be provided" } if {$remove ne ""} { set form_content [dict remove $form_content {*}$remove] ns_log notice "DEBUG: after removing <$remove> from <$form_content>" } # # Update the values coming from the form with our values. # foreach {att value} $update { if {[regexp {^(.*)\.(tmpfile|content-type)$} $att _ fieldname type]} { # # This parameter is the attribute of a file. # lappend files($fieldname) $type $value } else { # # This is a normal parameter # dict set form_content $att $value } } # # Cleanup all form parameters that will be sent as files # set form_content [dict remove $form_content {*}[array names files]] # # Now take all of the parameters that are files and build up # the list to pass to the payload creation. # set fs {} foreach {fieldname attrs} [array get files] { if {![dict exists $attrs tmpfile]} { error "'$fieldname' looks like a file upload, but no .tmpfile was specified" } set f [list fieldname $fieldname file [dict get $attrs tmpfile]] if {[dict exists $attrs content_type]} { lappend f mime_type [dict get $attrs content_type] } lappend fs $f } set payload [util::http::post_payload -files $fs -formvars_list $form_content] # # Send the POST request # return [http -user_id $user_id -last_request $last_request -method POST -body [dict get $payload payload] -headers [ns_set array [dict get $payload headers]] $url]XQL Not present: Generic, PostgreSQL, Oracle