_xowiki__nested_self_references (private)
_xowiki__nested_self_references
Defined in packages/xowiki/tcl/test/xowiki-test-procs.tcl
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set _aa_export {} set body_count 1 foreach testcase_body {{ # # Setup of test user_id and login # set user_info [::acs::test::user::create -email xowiki@acs-testing.test -admin] set request_info [::acs::test::login $user_info] set instance /xowiki-test set package_id [::acs::test::require_package_instance -package_key xowiki -empty -instance_name $instance] set testfolder .testfolder try { ########################################################### aa_section "Require test folder" ########################################################### set folder_info [::xowiki::test::require_test_folder -last_request $request_info -instance $instance -folder_name $testfolder -fresh ] set folder_id [dict get $folder_info folder_id] set package_id [dict get $folder_info package_id] aa_true "folder_id '$folder_id' is not 0" {$folder_id != 0} aa_section "Create father page 'en:father'" set parent_page [::xowiki::Page new -destroy_on_cleanup -title "I am your father, Hello World" -name en:father -package_id $package_id -parent_id $folder_id -text {{ {{en:father/hello}} } "text/plain"}] $parent_page save_new aa_section "Create child page 'en:hello'" set page [::xowiki::Page new -destroy_on_cleanup -title "Hello World" -name en:hello -package_id $package_id -parent_id [$parent_page item_id] -text {{ [[.SELF./image:hello_file|Hello File]] } "text/plain"}] $page save_new aa_section "Create image 'file:hello_file' as child of child page" set file_object [::xowiki::File new -destroy_on_cleanup -title "Hello World File" -name file:hello_file -parent_id [$page item_id] -mime_type image/png -package_id $package_id -creation_user [dict get $user_info user_id]] $file_object set import_file $::acs::rootdir/packages/acs-templating/www/resources/sort-ascending.png $file_object save_new aa_true "$file_object was saved" [nsf::is integer [$file_object item_id]] aa_section "load [$parent_page name] and check links" set d [acs::test::http -last_request $request_info [$parent_page pretty_link]] acs::test::reply_has_status_code $d 200 acs::test::dom_html root [dict get $d body] { set images [lmap p [$root selectNodes {//img[@class='image']/@src}] {file tail [lindex $p 1]}] set file_urls [lmap p [$root selectNodes {//img[@class='image']/@src}] {lindex $p 1}] } aa_true "File was found on the page" {"hello_file" in $images} foreach file_url $file_urls { set d [acs::test::http -last_request $request_info $file_url] acs::test::reply_has_status_code $d 200 set content_type [ns_set iget [dict get $d headers] content-type] aa_equals "Content type of $file_url is an image" image/png $content_type } aa_section "load [$page name] and check links" set d [acs::test::http -last_request $request_info [$page pretty_link]] acs::test::reply_has_status_code $d 200 acs::test::dom_html root [dict get $d body] { set images [lmap p [$root selectNodes {//img[@class='image']/@src}] {file tail [lindex $p 1]}] set file_urls [lmap p [$root selectNodes {//img[@class='image']/@src}] {lindex $p 1}] } aa_true "File was found on the page" [expr {"hello_file" in $images}] foreach file_url $file_urls { set d [acs::test::http -last_request $request_info $file_url] acs::test::reply_has_status_code $d 200 set content_type [ns_set iget [dict get $d headers] content-type] aa_equals "Content type is an image" image/png $content_type } } on error {errorMsg} { aa_true "Error msg: $errorMsg" 0 } finally { # # In case something has to be cleaned manually, do it here. # if {$package_id ne "" && $instance ne ""} { set node_id [site_node::get_element -url $instance -element node_id] site_node::delete -node_id $node_id -delete_package } } }} { aa_log "Running testcase body $body_count" set ::__aa_test_indent [info level] set catch_val [catch $testcase_body msg] if {$catch_val != 0 && $catch_val != 2} { aa_log_result "fail" "nested_self_references (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo" } incr body_count }XQL Not present: Generic, PostgreSQL, Oracle