Add role to test bundle

This commit is contained in:
bitfl0wer 2023-06-10 00:23:49 +02:00
parent 30db9e9553
commit 9c22d536df
No known key found for this signature in database
GPG Key ID: 84BBB60DF895ABF2
1 changed files with 21 additions and 1 deletions

View File

@ -1,6 +1,9 @@
use chorus::{
instance::{Instance, UserMeta},
types::{Channel, ChannelCreateSchema, Guild, GuildCreateSchema, RegisterSchema},
types::{
Channel, ChannelCreateSchema, Guild, GuildCreateSchema, RegisterSchema,
RoleCreateModifySchema, RoleObject,
},
URLBundle,
};
@ -10,6 +13,7 @@ pub struct TestBundle {
pub user: UserMeta,
pub instance: Instance,
pub guild: Guild,
pub role: RoleObject,
pub channel: Channel,
}
@ -70,11 +74,27 @@ pub async fn setup() -> TestBundle {
.await
.unwrap();
let role_create_schema: chorus::types::RoleCreateModifySchema = RoleCreateModifySchema {
name: Some("Bundle role".to_string()),
permissions: Some("8".to_string()), // Administrator permissions
hoist: Some(true),
icon: None,
unicode_emoji: Some("".to_string()),
mentionable: Some(true),
position: None,
color: None,
};
let guild_id = guild.id.clone().to_string();
let role = chorus::types::RoleObject::create(&mut user, &guild_id, role_create_schema)
.await
.unwrap();
TestBundle {
urls,
user,
instance,
guild,
role,
channel,
}
}