Add unit test for is_higher_mod_or_admin_check

This commit is contained in:
Dessalines 2024-07-07 13:23:27 -04:00
parent 1712cb1db3
commit bfdede4cb5

View file

@ -447,6 +447,7 @@ mod tests {
CommunityUpdateForm, CommunityUpdateForm,
}, },
instance::Instance, instance::Instance,
local_user::LocalUser,
person::{Person, PersonInsertForm}, person::{Person, PersonInsertForm},
}, },
traits::{Bannable, Crud, Followable, Joinable}, traits::{Bannable, Crud, Followable, Joinable},
@ -557,6 +558,16 @@ mod tests {
.await; .await;
assert!(bobby_higher_check.is_ok()); assert!(bobby_higher_check.is_ok());
// Also check the other is_higher_mod_or_admin function just in case
let bobby_higher_check_2 = LocalUser::is_higher_mod_or_admin_check(
pool,
inserted_community.id,
inserted_bobby.id,
&moderator_person_ids,
)
.await;
assert!(bobby_higher_check_2.is_ok());
// This should throw an error, since artemis was added later // This should throw an error, since artemis was added later
let artemis_higher_check = CommunityModerator::is_higher_mod_check( let artemis_higher_check = CommunityModerator::is_higher_mod_check(
pool, pool,