diff --git a/src/api/guilds/guilds.rs b/src/api/guilds/guilds.rs index 0c0137f..5bbbd23 100644 --- a/src/api/guilds/guilds.rs +++ b/src/api/guilds/guilds.rs @@ -114,53 +114,3 @@ impl<'a> types::Guild { } } } - -#[cfg(test)] -mod test { - use crate::api::schemas; - use crate::api::types; - use crate::instance::Instance; - - #[tokio::test] - async fn guild_creation_deletion() { - let mut instance = Instance::new(crate::URLBundle { - api: "http://localhost:3001/api".to_string(), - wss: "ws://localhost:3001/".to_string(), - cdn: "http://localhost:3001".to_string(), - }) - .await - .unwrap(); - let login_schema: schemas::LoginSchema = schemas::LoginSchema::new( - schemas::AuthUsername::new("user@test.xyz".to_string()).unwrap(), - "transrights".to_string(), - None, - None, - None, - None, - ) - .unwrap(); - let mut user = instance.login_account(&login_schema).await.unwrap(); - - let guild_create_schema = schemas::GuildCreateSchema { - name: Some("test".to_string()), - region: None, - icon: None, - channels: None, - guild_template_code: None, - system_channel_id: None, - rules_channel_id: None, - }; - - let guild = - types::Guild::create(&mut user, "http://localhost:3001/api", guild_create_schema) - .await - .unwrap(); - - println!("{}", guild); - - match types::Guild::delete(&mut user, "http://localhost:3001/api", guild).await { - None => assert!(true), - Some(_) => assert!(false), - } - } -} diff --git a/tests/integration.rs b/tests/integration.rs index e790c5d..e004496 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -41,3 +41,34 @@ async fn setup() -> TestBundle { async fn teardown(bundle: TestBundle) { bundle.user.delete().await; } + +mod guild { + use chorus::api::{schemas, types}; + + #[tokio::test] + async fn guild_creation_deletion() { + let mut bundle = crate::setup().await; + + let guild_create_schema = schemas::GuildCreateSchema { + name: Some("test".to_string()), + region: None, + icon: None, + channels: None, + guild_template_code: None, + system_channel_id: None, + rules_channel_id: None, + }; + + let guild = + types::Guild::create(&mut bundle.user, bundle.urls.get_api(), guild_create_schema) + .await + .unwrap(); + + println!("{}", guild); + + match types::Guild::delete(&mut bundle.user, bundle.urls.get_api(), guild).await { + None => assert!(true), + Some(_) => assert!(false), + } + } +}