Index: openacs-4/packages/acs-authentication/tcl/authority-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/authority-procs.tcl,v diff -u -r1.39.2.3 -r1.39.2.4 --- openacs-4/packages/acs-authentication/tcl/authority-procs.tcl 7 May 2019 10:26:56 -0000 1.39.2.3 +++ openacs-4/packages/acs-authentication/tcl/authority-procs.tcl 10 Sep 2019 15:45:12 -0000 1.39.2.4 @@ -285,6 +285,7 @@ Delete an authority. } { db_exec_plsql delete_authority {} + util_memoize_flush_pattern auth::authority::get_id_not_cached* } ad_proc -public auth::authority::get_authority_options {} { Index: openacs-4/packages/acs-authentication/tcl/test/acs-authentication-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/test/acs-authentication-procs.tcl,v diff -u -r1.53.2.4 -r1.53.2.5 --- openacs-4/packages/acs-authentication/tcl/test/acs-authentication-procs.tcl 24 Apr 2019 16:39:08 -0000 1.53.2.4 +++ openacs-4/packages/acs-authentication/tcl/test/acs-authentication-procs.tcl 10 Sep 2019 15:45:12 -0000 1.53.2.5 @@ -919,6 +919,46 @@ } } +aa_register_case \ + -cats {api} \ + -procs { + auth::authority::delete + auth::authority::get_id + } \ + auth_authority_delete { + Test authority deletion +} { + aa_log "Retrieving test authority" + set authority_id [auth::authority::get_id -short_name "acs_testing"] + aa_run_with_teardown \ + -rollback \ + -test_code { + aa_log "Make sure test authority has no users" + foreach user_id [db_list get_users { + select user_id from users where authority_id = :authority_id + }] { + aa_log "Deleting user_id '$user_id'" + acs_user::delete -user_id $user_id -permanent + } + + auth::authority::delete -authority_id $authority_id + + aa_true "Authority has been deleted" \ + {[auth::authority::get_id -short_name "acs_testing"] eq ""} + + } + aa_run_with_teardown \ + -rollback \ + -test_code { + aa_log "Make sure test authority has at least one user" + acs::test::user::create + + aa_true "Deleting an authority with users thorws an error" \ + [catch {auth::authority::delete -authority_id $authority_id}] + } +} + + # Local variables: # mode: tcl # tcl-indent-level: 4