mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-23 04:41:19 +00:00
Add unit test for is_higher_mod_or_admin_check
This commit is contained in:
parent
1712cb1db3
commit
bfdede4cb5
1 changed files with 11 additions and 0 deletions
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue