Add "lazy" test for guild_create_ban

This commit is contained in:
bitfl0wer 2023-08-20 18:55:47 +02:00
parent cb216c462d
commit 1f6b221413
1 changed files with 28 additions and 1 deletions

View File

@ -1,4 +1,4 @@
use chorus::types::{Guild, GuildCreateSchema}; use chorus::types::{CreateChannelInviteSchema, Guild, GuildBanCreateSchema, GuildCreateSchema};
mod common; mod common;
@ -31,3 +31,30 @@ async fn get_channels() {
println!("{:?}", guild.channels(&mut bundle.user).await.unwrap()); println!("{:?}", guild.channels(&mut bundle.user).await.unwrap());
common::teardown(bundle).await; common::teardown(bundle).await;
} }
#[tokio::test]
async fn guild_create_ban() {
// TODO: When routes exist to check if user x is on guild y, add this as an assertion to check
// if Spacebar actually bans the user.
let mut bundle = common::setup().await;
let channel = bundle.channel.read().unwrap().clone();
let mut other_user = bundle.create_user("testuser1312").await;
let user = &mut bundle.user;
let create_channel_invite_schema = CreateChannelInviteSchema::default();
let guild = bundle.guild.read().unwrap().clone();
let invite = user
.create_channel_invite(create_channel_invite_schema, channel.id)
.await
.unwrap();
other_user.accept_invite(&invite.code, None).await.unwrap();
let other_user_id = other_user.object.read().unwrap().id;
Guild::create_ban(
guild.id,
other_user_id,
GuildBanCreateSchema::default(),
&mut bundle.user,
)
.await
.unwrap();
common::teardown(bundle).await
}