file_storage::test::delete_first_file (private)

 file_storage::test::delete_first_file -last_request last_request \
    file_name

Defined in packages/file-storage/tcl/test/webtest-procs.tcl

Delete the current file via Web UI.

Switches:
-last_request (required)
Parameters:
file_name (required)

Partial Call Graph (max 5 caller/called nodes):
%3 aa_log aa_log (public) aa_true aa_true (public) acs::test::dom_html acs::test::dom_html (public) acs::test::form_reply acs::test::form_reply (public) acs::test::get_form acs::test::get_form (public) file_storage::test::delete_first_file file_storage::test::delete_first_file file_storage::test::delete_first_file->aa_log file_storage::test::delete_first_file->aa_true file_storage::test::delete_first_file->acs::test::dom_html file_storage::test::delete_first_file->acs::test::form_reply file_storage::test::delete_first_file->acs::test::get_form

Testcases:
No testcase defined.
Source code:

        #
        # Delete the first displayed file (current rather crude,
        # failure must be detectable from return code). Using a class
        # for the anchor in the bulk actions would be helpful
        #
        acs::test::dom_html root [dict get $last_request body] {
            #
            # We are looking for links of the following form
            #
            #    <a href="/file-storage/file-add?file_id=36962" title="Upload a new version">Neu</a>
            #
            # to obtain the instance and the object_id

            foreach a [$root selectNodes {//a[contains(@href,'file-add')]}] {
                set href1 [$a getAttribute href]
                #
                # make sure the match was not from a return_url
                #
                if {[regexp {^[^?]+[?]} $href1 match]} {
                    if {[string match *file-add* $match]} {
                        set href $href1
                        break
                    }
                }
            }
        }
        aa_log "Download link '$href'"

        regsub -all /file-add $href /delete href
        regsub -all file_id= $href object_id= href
        aa_log "Delete link '$href'"
        set d [acs::test::http -last_request $last_request$href]
        acs::test::reply_has_status_code $d 200
        #
        # Get confirm form
        #
        set form [acs::test::get_form [dict get $d body] {//form[@id='delete_confirm']}]
        aa_true "delete confirm form was returned" {[llength $form] > 2}
        set d [::acs::test::form_reply -last_request $d -form $form]
        acs::test::reply_has_status_code $d 302

        return $d
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: