Index: openacs-4/packages/acs-tcl/tcl/test/utilities-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/Attic/utilities-procs.tcl,v diff -u -N -r1.1.2.18 -r1.1.2.19 --- openacs-4/packages/acs-tcl/tcl/test/utilities-procs.tcl 2 Mar 2023 12:32:42 -0000 1.1.2.18 +++ openacs-4/packages/acs-tcl/tcl/test/utilities-procs.tcl 21 Apr 2023 15:34:24 -0000 1.1.2.19 @@ -5,6 +5,43 @@ } aa_register_case \ + -cats {api smoke} \ + -procs { + util::zip + util::unzip + util::file_content_check + ad_mktmpdir + ad_opentmpfile + } \ + zip_and_unzip { + Test zip and unzip utilities: we create a tempfile in a + tempfilder, we zip it, then unzip it and check that everything + is fine. + } { + set tmpdir [ad_mktmpdir] + set wfd [ad_opentmpfile tmpname] + puts $wfd ABCD + close $wfd + set checksum [ns_md file $tmpname] + file rename -- $tmpname $tmpdir + + util::zip -source $tmpdir -destination $tmpdir/test.zip + + aa_true "Zip '$tmpdir/test.zip' was created" \ + [util::file_content_check \ + -type zip \ + -filename $tmpdir/test.zip] + + aa_log "Unzipping the file" + set tmpdir2 [ad_mktmpdir] + util::unzip -source $tmpdir/test.zip -destination $tmpdir2 + + set tmpname [file tail $tmpname] + aa_true "File '$tmpdir2/$tmpname' was created" [file exists $tmpdir2/$tmpname] + aa_equals "File content is correct" [ns_md file $tmpdir2/$tmpname] $checksum + } + +aa_register_case \ -cats {api smoke production_safe} \ -procs { ad_safe_eval