Index: openacs-4/packages/acs-lang/tcl/test/acs-lang-message-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/test/acs-lang-message-procs.tcl,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/packages/acs-lang/tcl/test/acs-lang-message-procs.tcl 22 Jul 2018 09:46:48 -0000 1.3 +++ openacs-4/packages/acs-lang/tcl/test/acs-lang-message-procs.tcl 31 Jan 2022 16:25:19 -0000 1.3.2.1 @@ -9,10 +9,13 @@ -procs { lang::message::register lang::message::get + lang::message::delete } \ test_message_register { - Simple test that registrates a new message to the BD. + Test the registration of a new message key, retrieval, soft + deletion and reinstating. + } { aa_run_with_teardown -rollback -test_code { @@ -34,6 +37,37 @@ -array message_new aa_equals "Message add succeeded" $message_new(message) $message + + aa_log "Soft-delete the message" + lang::message::delete \ + -package_key $package_key \ + -message_key $message_key \ + -locale $locale + + set key "${package_key}.${message_key}" + aa_false "The nsv was deleted" [nsv_exists lang_message_$locale $key] + + aa_log "Delete the nsv regardless to simulate the behavior after restart" + nsv_unset -nocomplain -- lang_message_$locale $key + + aa_true "Message still exists, flagged as deleted" [db_0or1row check { + select 1 from lang_messages + where locale = :locale + and package_key = :package_key + and message_key = :message_key + and deleted_p + }] + + # Register the message again + lang::message::register $locale $package_key $message_key $message + + aa_true "Message was reinstated" [db_0or1row check { + select 1 from lang_messages + where locale = :locale + and package_key = :package_key + and message_key = :message_key + and not deleted_p + }] } }