From 0887ba1019f0eb3a463cb8ec52ec1eec9562d0e8 Mon Sep 17 00:00:00 2001 From: bitfl0wer Date: Sat, 10 Jun 2023 00:23:49 +0200 Subject: [PATCH] Add role to test bundle --- tests/common/mod.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 4b20399..c58c79a 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -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, } }