faq::twt::edit_one (private)

 faq::twt::edit_one faq_name faq_new_name

Defined in packages/faq/tcl/test/tclwebtest-procs.tcl

Edits a FAQ from the UI by decoding faq_name and retrieving directly edit URL by faq_id.

Parameters:
faq_name
faq_new_name

Partial Call Graph (max 5 caller/called nodes):
%3 aa_error aa_error (public) aa_get_first_url aa_get_first_url (public) aa_log aa_log (public) db_1row db_1row (public) export_vars export_vars (public) faq::twt::edit_one faq::twt::edit_one faq::twt::edit_one->aa_error faq::twt::edit_one->aa_get_first_url faq::twt::edit_one->aa_log faq::twt::edit_one->db_1row faq::twt::edit_one->export_vars

Testcases:
No testcase defined.
Source code:
        set response 0

        db_1row faq_id "select faq_id from faqs where faq_name=:faq_name"

        # Edit the FAQ and request the FAQ Admin page
        # The Faq page url
        set faq_page_url [aa_get_first_url -package_key faq]
        ::twt::do_request $faq_page_url

        tclwebtest::link follow "administer"
        ::twt::do_request [export_vars -base "faq-add-edit" {faq_id}]

        tclwebtest::form find ~n "faq_add_edit"
        tclwebtest::field find ~n "faq_name"
        tclwebtest::field fill "$faq_new_name"
        tclwebtest::form submit
        aa_log " Faq form submitted"

        set response_url [tclwebtest::response url]

        if {[string match "*admin/one-faq*" $response_url] } {
            if { [catch {tclwebtest::form find ~n "faq_add_edit"} errmsg] || [catch {tclwebtest::field find ~v "$faq_new_name"} errmsg] } {
                aa_error  "faq::twt::edit_one failed $errmsg : Don't Edit a Faq"
            } else {
                aa_log "Faq Edited"
                set response 1
            }
        } else {
            aa_error "faq::twt::edit_one failed, bad response url : $response_url"
        }

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