Add role to test bundle

This commit is contained in:
bitfl0wer 2023-06-10 00:23:49 +02:00
parent 9fb6c8c6f9
commit 0887ba1019
1 changed files with 21 additions and 1 deletions

View File

@ -1,6 +1,9 @@
use chorus::{ use chorus::{
instance::{Instance, UserMeta}, instance::{Instance, UserMeta},
types::{Channel, ChannelCreateSchema, Guild, GuildCreateSchema, RegisterSchema}, types::{
Channel, ChannelCreateSchema, Guild, GuildCreateSchema, RegisterSchema,
RoleCreateModifySchema, RoleObject,
},
URLBundle, URLBundle,
}; };
@ -10,6 +13,7 @@ pub struct TestBundle {
pub user: UserMeta, pub user: UserMeta,
pub instance: Instance, pub instance: Instance,
pub guild: Guild, pub guild: Guild,
pub role: RoleObject,
pub channel: Channel, pub channel: Channel,
} }
@ -70,11 +74,27 @@ pub async fn setup() -> TestBundle {
.await .await
.unwrap(); .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 { TestBundle {
urls, urls,
user, user,
instance, instance,
guild, guild,
role,
channel, channel,
} }
} }