faq::twt::disable_enable (private)

 faq::twt::disable_enable faq_name option

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

Toggle enable/disable for a FAQ from the UI.

Parameters:
faq_name
option

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::disable_enable faq::twt::disable_enable faq::twt::disable_enable->aa_error faq::twt::disable_enable->aa_get_first_url faq::twt::disable_enable->aa_log faq::twt::disable_enable->db_1row faq::twt::disable_enable->export_vars

Testcases:
No testcase defined.
Source code:
    # Option : disable or enable

        set response 0

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

        # 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"
        set optionurl [export_vars -base "faq-${option}" {faq_id}]
        ::twt::do_request $optionurl
        aa_log "url:$optionurl"

        set response_url [tclwebtest::response url]

        if { [string match "*$faq_page_url*" $response_url] } {
            if {![catch {tclwebtest::link find ~u  $optionurl } errmsg]} {
                aa_error "faq::twt::$option failed $errmsg : Don't $option $faq_name Faq"
            } else {
                aa_log "Faq $option"
                set response 1
            }
        } else {
            aa_error "faq::twt::$option failed. Bad  response url : $response_url "
        }

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