2024-01-30 17:19:34 +01:00
|
|
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
2024-06-19 19:59:39 +02:00
|
|
|
use chorus::types::{self, Channel, GetChannelMessagesSchema, MessageSendSchema, PermissionFlags, PermissionOverwrite, PermissionOverwriteType, PrivateChannelCreateSchema, RelationshipType, Snowflake};
|
2023-05-27 22:12:15 +02:00
|
|
|
|
2023-06-11 13:52:31 +02:00
|
|
|
mod common;
|
2023-11-20 14:03:06 +01:00
|
|
|
|
|
|
|
#[cfg(target_arch = "wasm32")]
|
|
|
|
use wasm_bindgen_test::*;
|
|
|
|
#[cfg(target_arch = "wasm32")]
|
|
|
|
wasm_bindgen_test_configure!(run_in_browser);
|
2023-06-11 13:52:31 +02:00
|
|
|
|
2023-11-22 14:39:32 +01:00
|
|
|
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
|
|
|
|
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
|
2023-05-27 22:12:15 +02:00
|
|
|
async fn get_channel() {
|
|
|
|
let mut bundle = common::setup().await;
|
2023-08-13 15:54:07 +02:00
|
|
|
let bundle_channel = bundle.channel.read().unwrap().clone();
|
2023-06-11 13:54:54 +02:00
|
|
|
let bundle_user = &mut bundle.user;
|
2023-05-27 22:12:15 +02:00
|
|
|
|
|
|
|
assert_eq!(
|
2023-08-13 15:54:07 +02:00
|
|
|
bundle_channel,
|
2023-06-22 13:14:07 +02:00
|
|
|
Channel::get(bundle_user, bundle_channel.id).await.unwrap()
|
2023-05-27 22:12:15 +02:00
|
|
|
);
|
|
|
|
common::teardown(bundle).await
|
|
|
|
}
|
2023-05-28 23:04:56 +02:00
|
|
|
|
2023-11-22 14:39:32 +01:00
|
|
|
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
|
|
|
|
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
|
2023-05-28 23:04:56 +02:00
|
|
|
async fn delete_channel() {
|
|
|
|
let mut bundle = common::setup().await;
|
2023-08-13 15:54:07 +02:00
|
|
|
let channel_guard = bundle.channel.write().unwrap().clone();
|
2023-08-25 00:02:26 +02:00
|
|
|
let result = Channel::delete(channel_guard, None, &mut bundle.user).await;
|
2023-06-20 18:33:37 +02:00
|
|
|
assert!(result.is_ok());
|
2023-05-29 18:29:08 +02:00
|
|
|
common::teardown(bundle).await
|
2023-05-28 23:04:56 +02:00
|
|
|
}
|
2023-05-29 18:50:09 +02:00
|
|
|
|
2023-11-22 14:39:32 +01:00
|
|
|
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
|
|
|
|
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
|
2023-05-29 18:50:09 +02:00
|
|
|
async fn modify_channel() {
|
2023-07-21 15:35:31 +02:00
|
|
|
const CHANNEL_NAME: &str = "beepboop";
|
2023-05-29 18:50:09 +02:00
|
|
|
let mut bundle = common::setup().await;
|
2023-08-13 15:54:07 +02:00
|
|
|
let channel = &mut bundle.channel.read().unwrap().clone();
|
2023-05-29 18:50:09 +02:00
|
|
|
let modify_data: types::ChannelModifySchema = types::ChannelModifySchema {
|
2023-07-21 15:35:31 +02:00
|
|
|
name: Some(CHANNEL_NAME.to_string()),
|
2023-05-29 18:50:09 +02:00
|
|
|
channel_type: None,
|
|
|
|
topic: None,
|
|
|
|
icon: None,
|
|
|
|
bitrate: None,
|
|
|
|
user_limit: None,
|
|
|
|
rate_limit_per_user: None,
|
|
|
|
position: None,
|
|
|
|
permission_overwrites: None,
|
|
|
|
parent_id: None,
|
|
|
|
nsfw: None,
|
|
|
|
rtc_region: None,
|
|
|
|
default_auto_archive_duration: None,
|
|
|
|
default_reaction_emoji: None,
|
|
|
|
flags: None,
|
|
|
|
default_thread_rate_limit_per_user: None,
|
|
|
|
video_quality_mode: None,
|
|
|
|
};
|
2023-08-25 00:02:26 +02:00
|
|
|
let modified_channel = channel
|
|
|
|
.modify(modify_data, None, &mut bundle.user)
|
|
|
|
.await
|
|
|
|
.unwrap();
|
2023-07-21 15:35:31 +02:00
|
|
|
assert_eq!(modified_channel.name, Some(CHANNEL_NAME.to_string()));
|
2023-06-10 22:26:15 +02:00
|
|
|
|
2024-06-19 19:59:39 +02:00
|
|
|
let permission_override = PermissionFlags::MANAGE_CHANNELS | PermissionFlags::MANAGE_MESSAGES;
|
2023-08-13 15:54:07 +02:00
|
|
|
let user_id: types::Snowflake = bundle.user.object.read().unwrap().id;
|
2023-06-10 22:26:15 +02:00
|
|
|
let permission_override = PermissionOverwrite {
|
2023-08-04 11:19:23 +02:00
|
|
|
id: user_id,
|
2024-06-19 19:59:39 +02:00
|
|
|
overwrite_type: PermissionOverwriteType::Member,
|
2023-06-10 22:26:15 +02:00
|
|
|
allow: permission_override,
|
2024-06-19 19:59:39 +02:00
|
|
|
deny: PermissionFlags::empty(),
|
2023-06-10 22:26:15 +02:00
|
|
|
};
|
2023-08-13 15:54:07 +02:00
|
|
|
let channel_id: Snowflake = bundle.channel.read().unwrap().id;
|
2023-08-25 00:02:26 +02:00
|
|
|
Channel::modify_permissions(
|
|
|
|
&mut bundle.user,
|
|
|
|
channel_id,
|
|
|
|
None,
|
|
|
|
permission_override.clone(),
|
|
|
|
)
|
|
|
|
.await
|
|
|
|
.unwrap();
|
2023-06-10 22:26:15 +02:00
|
|
|
|
2023-08-13 15:54:07 +02:00
|
|
|
Channel::delete_permission(&mut bundle.user, channel_id, permission_override.id)
|
2023-06-20 22:03:29 +02:00
|
|
|
.await
|
|
|
|
.unwrap();
|
2023-06-10 22:26:15 +02:00
|
|
|
|
2023-05-29 18:50:09 +02:00
|
|
|
common::teardown(bundle).await
|
|
|
|
}
|
2023-06-20 22:04:05 +02:00
|
|
|
|
2023-11-22 14:39:32 +01:00
|
|
|
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
|
|
|
|
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
|
2023-06-20 22:04:05 +02:00
|
|
|
async fn get_channel_messages() {
|
|
|
|
let mut bundle = common::setup().await;
|
2023-08-13 15:54:07 +02:00
|
|
|
let channel_id: Snowflake = bundle.channel.read().unwrap().id;
|
2023-06-20 22:04:05 +02:00
|
|
|
// First create some messages to read
|
|
|
|
for _ in 0..10 {
|
|
|
|
let _ = bundle
|
|
|
|
.user
|
|
|
|
.send_message(
|
2023-07-17 23:26:25 +02:00
|
|
|
MessageSendSchema {
|
2023-06-20 22:04:05 +02:00
|
|
|
content: Some("A Message!".to_string()),
|
|
|
|
..Default::default()
|
|
|
|
},
|
2023-08-13 15:54:07 +02:00
|
|
|
channel_id,
|
2023-06-20 22:04:05 +02:00
|
|
|
)
|
|
|
|
.await
|
|
|
|
.unwrap();
|
|
|
|
}
|
|
|
|
|
|
|
|
assert_eq!(
|
|
|
|
Channel::messages(
|
|
|
|
GetChannelMessagesSchema::before(Snowflake::generate()),
|
2023-08-13 15:54:07 +02:00
|
|
|
channel_id,
|
2023-06-20 22:04:05 +02:00
|
|
|
&mut bundle.user,
|
|
|
|
)
|
|
|
|
.await
|
|
|
|
.unwrap()
|
|
|
|
.len(),
|
|
|
|
10
|
|
|
|
);
|
|
|
|
|
|
|
|
// around is currently bugged in spacebar: https://github.com/spacebarchat/server/issues/1072
|
|
|
|
// assert_eq!(
|
|
|
|
// Channel::messages(
|
|
|
|
// GetChannelMessagesSchema::around(Snowflake::generate()).limit(10),
|
|
|
|
// bundle.channel.id,
|
|
|
|
// &mut bundle.user,
|
|
|
|
// )
|
|
|
|
// .await
|
|
|
|
// .unwrap()
|
|
|
|
// .len(),
|
|
|
|
// 5
|
|
|
|
// );
|
|
|
|
|
|
|
|
assert!(Channel::messages(
|
|
|
|
GetChannelMessagesSchema::after(Snowflake::generate()),
|
2023-08-13 15:54:07 +02:00
|
|
|
channel_id,
|
2023-06-20 22:04:05 +02:00
|
|
|
&mut bundle.user,
|
|
|
|
)
|
|
|
|
.await
|
|
|
|
.unwrap()
|
|
|
|
.is_empty());
|
|
|
|
|
|
|
|
common::teardown(bundle).await
|
|
|
|
}
|
Join/Leave Guilds, (Group) DMs and minor improvements (#157)
## Summary:
**Added:**
- Schemas `PrivateChannelCreateSchema` `ChannelInviteCreateSchema`, `AddChannelRecipientSchema` recursively (including schemas which were needed to create these schemas)
- Methods `create_private_channel`, `leave_guild`, `accept_invite`, `create_user_invite`, `create_guild_invite`, `add_channel_recipient`, `remove_channel_recipient`
- Integration tests for the functionality covered by implementing #45
- Documentation in some places where I noticed it would be useful to have some
- `create_user` method in `/src/tests`: Cuts down on test boilerplate needed to create an addition test user
**Changed:**
- `.gitignore`
- Added `.DS_store` files to gitignore (some weird macos files), removed Cargo.lock, as Cargo.lock should be included for libraries
- Added a lot of default trait derives like Clone, Copy, PartialEq, Eq, Ord, PartialOrd to structs and enums where I saw them missing
- Added missing `teardown()` calls to the integration tests
- Renamed integration test files in `/src/tests` dir to all be plural: `channel.rs` -> `channels.rs`
- Made more fields on `User` type `Option<>`
- All instances in `/src/tests` where a second test user was created using a RegistrationSchema and the register_user method were replaced with the new `create_user` method
- README.md: Marked roadmap fields covered by #45 as implemented
- Changed visibility of `/src/tests/common/mod.rs` methods from `pub` to `pub(crate)`. In hindsight, this was probably not required, haha
**Removed:**
- Unneeded import in`src/types/config/types/guild_configuration.rs`
## Commit log:
* Add .DS_store, remove Cargo.lock
* Create PrivateChannelCreateSchema
* pub use users
* add channels.rs
* create channels.rs
* Add Deserialize/Serialize derives
* Implement create_private_channel
* Add create_dm() test
* Make optional fields on `User` `Option<>`
* Check boxes for implemented features
* Create users/guilds.rs
* Remove unneeded import
* Add UserMeta::leave_guild()
* Create api/invites/mod.rs
* Add debug print to send_request
* Rename tests files
* Create invites.rs
* create invite.rs
* Add documentation
* Implement accept_invite
* Sort fields on Channel alphabetically
* Add invite mod
* Add forgotten teardown() at test end
* change visiblities, add create_user()
* Implement `create_user_invite()`
* start working on invite tests
* Add allow flags
* Fix bad url
* Create CreateChannelInviteSchema and friends
* remove non-implemented test code
* add body to requests
* Add Clone to UserMeta
* More comprehensive error message when running into a deserialization error
* Add arguments documentation to accept_invite
* Add Eq derive to GuildFeaturesList
* Add Eq derive to Emoji
* Add Eq derive to GuildBan
* Add create_accept_invite() test
* Add Default derive to ChannelCreateSchema
* Change create_guild_invite to return GuildInvite
* Dates as chrono::Date(Utc); sort alphabetically
* Add default derives wherever possible
* Implement add_- and remove_channel_recipient
* Create AddChannelRecipientSchema
* replace otheruser regs with bundle.creeate_user()
* Add (disabled) test remove_add_person_from_to_dm()
2023-07-17 19:36:28 +02:00
|
|
|
|
2023-11-22 14:39:32 +01:00
|
|
|
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
|
|
|
|
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
|
Join/Leave Guilds, (Group) DMs and minor improvements (#157)
## Summary:
**Added:**
- Schemas `PrivateChannelCreateSchema` `ChannelInviteCreateSchema`, `AddChannelRecipientSchema` recursively (including schemas which were needed to create these schemas)
- Methods `create_private_channel`, `leave_guild`, `accept_invite`, `create_user_invite`, `create_guild_invite`, `add_channel_recipient`, `remove_channel_recipient`
- Integration tests for the functionality covered by implementing #45
- Documentation in some places where I noticed it would be useful to have some
- `create_user` method in `/src/tests`: Cuts down on test boilerplate needed to create an addition test user
**Changed:**
- `.gitignore`
- Added `.DS_store` files to gitignore (some weird macos files), removed Cargo.lock, as Cargo.lock should be included for libraries
- Added a lot of default trait derives like Clone, Copy, PartialEq, Eq, Ord, PartialOrd to structs and enums where I saw them missing
- Added missing `teardown()` calls to the integration tests
- Renamed integration test files in `/src/tests` dir to all be plural: `channel.rs` -> `channels.rs`
- Made more fields on `User` type `Option<>`
- All instances in `/src/tests` where a second test user was created using a RegistrationSchema and the register_user method were replaced with the new `create_user` method
- README.md: Marked roadmap fields covered by #45 as implemented
- Changed visibility of `/src/tests/common/mod.rs` methods from `pub` to `pub(crate)`. In hindsight, this was probably not required, haha
**Removed:**
- Unneeded import in`src/types/config/types/guild_configuration.rs`
## Commit log:
* Add .DS_store, remove Cargo.lock
* Create PrivateChannelCreateSchema
* pub use users
* add channels.rs
* create channels.rs
* Add Deserialize/Serialize derives
* Implement create_private_channel
* Add create_dm() test
* Make optional fields on `User` `Option<>`
* Check boxes for implemented features
* Create users/guilds.rs
* Remove unneeded import
* Add UserMeta::leave_guild()
* Create api/invites/mod.rs
* Add debug print to send_request
* Rename tests files
* Create invites.rs
* create invite.rs
* Add documentation
* Implement accept_invite
* Sort fields on Channel alphabetically
* Add invite mod
* Add forgotten teardown() at test end
* change visiblities, add create_user()
* Implement `create_user_invite()`
* start working on invite tests
* Add allow flags
* Fix bad url
* Create CreateChannelInviteSchema and friends
* remove non-implemented test code
* add body to requests
* Add Clone to UserMeta
* More comprehensive error message when running into a deserialization error
* Add arguments documentation to accept_invite
* Add Eq derive to GuildFeaturesList
* Add Eq derive to Emoji
* Add Eq derive to GuildBan
* Add create_accept_invite() test
* Add Default derive to ChannelCreateSchema
* Change create_guild_invite to return GuildInvite
* Dates as chrono::Date(Utc); sort alphabetically
* Add default derives wherever possible
* Implement add_- and remove_channel_recipient
* Create AddChannelRecipientSchema
* replace otheruser regs with bundle.creeate_user()
* Add (disabled) test remove_add_person_from_to_dm()
2023-07-17 19:36:28 +02:00
|
|
|
async fn create_dm() {
|
|
|
|
let mut bundle = common::setup().await;
|
|
|
|
let other_user = bundle.create_user("integrationtestuser2").await;
|
|
|
|
let user = &mut bundle.user;
|
|
|
|
let private_channel_create_schema = PrivateChannelCreateSchema {
|
2023-08-12 19:31:31 +02:00
|
|
|
recipients: Some(Vec::from([other_user.object.read().unwrap().id])),
|
Join/Leave Guilds, (Group) DMs and minor improvements (#157)
## Summary:
**Added:**
- Schemas `PrivateChannelCreateSchema` `ChannelInviteCreateSchema`, `AddChannelRecipientSchema` recursively (including schemas which were needed to create these schemas)
- Methods `create_private_channel`, `leave_guild`, `accept_invite`, `create_user_invite`, `create_guild_invite`, `add_channel_recipient`, `remove_channel_recipient`
- Integration tests for the functionality covered by implementing #45
- Documentation in some places where I noticed it would be useful to have some
- `create_user` method in `/src/tests`: Cuts down on test boilerplate needed to create an addition test user
**Changed:**
- `.gitignore`
- Added `.DS_store` files to gitignore (some weird macos files), removed Cargo.lock, as Cargo.lock should be included for libraries
- Added a lot of default trait derives like Clone, Copy, PartialEq, Eq, Ord, PartialOrd to structs and enums where I saw them missing
- Added missing `teardown()` calls to the integration tests
- Renamed integration test files in `/src/tests` dir to all be plural: `channel.rs` -> `channels.rs`
- Made more fields on `User` type `Option<>`
- All instances in `/src/tests` where a second test user was created using a RegistrationSchema and the register_user method were replaced with the new `create_user` method
- README.md: Marked roadmap fields covered by #45 as implemented
- Changed visibility of `/src/tests/common/mod.rs` methods from `pub` to `pub(crate)`. In hindsight, this was probably not required, haha
**Removed:**
- Unneeded import in`src/types/config/types/guild_configuration.rs`
## Commit log:
* Add .DS_store, remove Cargo.lock
* Create PrivateChannelCreateSchema
* pub use users
* add channels.rs
* create channels.rs
* Add Deserialize/Serialize derives
* Implement create_private_channel
* Add create_dm() test
* Make optional fields on `User` `Option<>`
* Check boxes for implemented features
* Create users/guilds.rs
* Remove unneeded import
* Add UserMeta::leave_guild()
* Create api/invites/mod.rs
* Add debug print to send_request
* Rename tests files
* Create invites.rs
* create invite.rs
* Add documentation
* Implement accept_invite
* Sort fields on Channel alphabetically
* Add invite mod
* Add forgotten teardown() at test end
* change visiblities, add create_user()
* Implement `create_user_invite()`
* start working on invite tests
* Add allow flags
* Fix bad url
* Create CreateChannelInviteSchema and friends
* remove non-implemented test code
* add body to requests
* Add Clone to UserMeta
* More comprehensive error message when running into a deserialization error
* Add arguments documentation to accept_invite
* Add Eq derive to GuildFeaturesList
* Add Eq derive to Emoji
* Add Eq derive to GuildBan
* Add create_accept_invite() test
* Add Default derive to ChannelCreateSchema
* Change create_guild_invite to return GuildInvite
* Dates as chrono::Date(Utc); sort alphabetically
* Add default derives wherever possible
* Implement add_- and remove_channel_recipient
* Create AddChannelRecipientSchema
* replace otheruser regs with bundle.creeate_user()
* Add (disabled) test remove_add_person_from_to_dm()
2023-07-17 19:36:28 +02:00
|
|
|
access_tokens: None,
|
|
|
|
nicks: None,
|
|
|
|
};
|
|
|
|
let dm_channel = user
|
|
|
|
.create_private_channel(private_channel_create_schema)
|
|
|
|
.await
|
|
|
|
.unwrap();
|
|
|
|
assert!(dm_channel.recipients.is_some());
|
|
|
|
assert_eq!(
|
2023-08-04 11:19:23 +02:00
|
|
|
dm_channel
|
|
|
|
.recipients
|
|
|
|
.as_ref()
|
2024-07-18 23:04:35 +02:00
|
|
|
.unwrap().first()
|
2023-08-04 11:19:23 +02:00
|
|
|
.unwrap()
|
2023-08-12 19:31:31 +02:00
|
|
|
.read()
|
2023-08-04 11:19:23 +02:00
|
|
|
.unwrap()
|
|
|
|
.id
|
|
|
|
.clone(),
|
2023-08-12 19:31:31 +02:00
|
|
|
other_user.object.read().unwrap().id
|
Join/Leave Guilds, (Group) DMs and minor improvements (#157)
## Summary:
**Added:**
- Schemas `PrivateChannelCreateSchema` `ChannelInviteCreateSchema`, `AddChannelRecipientSchema` recursively (including schemas which were needed to create these schemas)
- Methods `create_private_channel`, `leave_guild`, `accept_invite`, `create_user_invite`, `create_guild_invite`, `add_channel_recipient`, `remove_channel_recipient`
- Integration tests for the functionality covered by implementing #45
- Documentation in some places where I noticed it would be useful to have some
- `create_user` method in `/src/tests`: Cuts down on test boilerplate needed to create an addition test user
**Changed:**
- `.gitignore`
- Added `.DS_store` files to gitignore (some weird macos files), removed Cargo.lock, as Cargo.lock should be included for libraries
- Added a lot of default trait derives like Clone, Copy, PartialEq, Eq, Ord, PartialOrd to structs and enums where I saw them missing
- Added missing `teardown()` calls to the integration tests
- Renamed integration test files in `/src/tests` dir to all be plural: `channel.rs` -> `channels.rs`
- Made more fields on `User` type `Option<>`
- All instances in `/src/tests` where a second test user was created using a RegistrationSchema and the register_user method were replaced with the new `create_user` method
- README.md: Marked roadmap fields covered by #45 as implemented
- Changed visibility of `/src/tests/common/mod.rs` methods from `pub` to `pub(crate)`. In hindsight, this was probably not required, haha
**Removed:**
- Unneeded import in`src/types/config/types/guild_configuration.rs`
## Commit log:
* Add .DS_store, remove Cargo.lock
* Create PrivateChannelCreateSchema
* pub use users
* add channels.rs
* create channels.rs
* Add Deserialize/Serialize derives
* Implement create_private_channel
* Add create_dm() test
* Make optional fields on `User` `Option<>`
* Check boxes for implemented features
* Create users/guilds.rs
* Remove unneeded import
* Add UserMeta::leave_guild()
* Create api/invites/mod.rs
* Add debug print to send_request
* Rename tests files
* Create invites.rs
* create invite.rs
* Add documentation
* Implement accept_invite
* Sort fields on Channel alphabetically
* Add invite mod
* Add forgotten teardown() at test end
* change visiblities, add create_user()
* Implement `create_user_invite()`
* start working on invite tests
* Add allow flags
* Fix bad url
* Create CreateChannelInviteSchema and friends
* remove non-implemented test code
* add body to requests
* Add Clone to UserMeta
* More comprehensive error message when running into a deserialization error
* Add arguments documentation to accept_invite
* Add Eq derive to GuildFeaturesList
* Add Eq derive to Emoji
* Add Eq derive to GuildBan
* Add create_accept_invite() test
* Add Default derive to ChannelCreateSchema
* Change create_guild_invite to return GuildInvite
* Dates as chrono::Date(Utc); sort alphabetically
* Add default derives wherever possible
* Implement add_- and remove_channel_recipient
* Create AddChannelRecipientSchema
* replace otheruser regs with bundle.creeate_user()
* Add (disabled) test remove_add_person_from_to_dm()
2023-07-17 19:36:28 +02:00
|
|
|
);
|
|
|
|
assert_eq!(
|
2023-08-04 11:19:23 +02:00
|
|
|
dm_channel
|
|
|
|
.recipients
|
|
|
|
.as_ref()
|
|
|
|
.unwrap()
|
|
|
|
.get(1)
|
|
|
|
.unwrap()
|
2023-08-12 19:31:31 +02:00
|
|
|
.read()
|
2023-08-04 11:19:23 +02:00
|
|
|
.unwrap()
|
|
|
|
.id
|
|
|
|
.clone(),
|
2023-08-12 19:31:31 +02:00
|
|
|
user.object.read().unwrap().id.clone()
|
Join/Leave Guilds, (Group) DMs and minor improvements (#157)
## Summary:
**Added:**
- Schemas `PrivateChannelCreateSchema` `ChannelInviteCreateSchema`, `AddChannelRecipientSchema` recursively (including schemas which were needed to create these schemas)
- Methods `create_private_channel`, `leave_guild`, `accept_invite`, `create_user_invite`, `create_guild_invite`, `add_channel_recipient`, `remove_channel_recipient`
- Integration tests for the functionality covered by implementing #45
- Documentation in some places where I noticed it would be useful to have some
- `create_user` method in `/src/tests`: Cuts down on test boilerplate needed to create an addition test user
**Changed:**
- `.gitignore`
- Added `.DS_store` files to gitignore (some weird macos files), removed Cargo.lock, as Cargo.lock should be included for libraries
- Added a lot of default trait derives like Clone, Copy, PartialEq, Eq, Ord, PartialOrd to structs and enums where I saw them missing
- Added missing `teardown()` calls to the integration tests
- Renamed integration test files in `/src/tests` dir to all be plural: `channel.rs` -> `channels.rs`
- Made more fields on `User` type `Option<>`
- All instances in `/src/tests` where a second test user was created using a RegistrationSchema and the register_user method were replaced with the new `create_user` method
- README.md: Marked roadmap fields covered by #45 as implemented
- Changed visibility of `/src/tests/common/mod.rs` methods from `pub` to `pub(crate)`. In hindsight, this was probably not required, haha
**Removed:**
- Unneeded import in`src/types/config/types/guild_configuration.rs`
## Commit log:
* Add .DS_store, remove Cargo.lock
* Create PrivateChannelCreateSchema
* pub use users
* add channels.rs
* create channels.rs
* Add Deserialize/Serialize derives
* Implement create_private_channel
* Add create_dm() test
* Make optional fields on `User` `Option<>`
* Check boxes for implemented features
* Create users/guilds.rs
* Remove unneeded import
* Add UserMeta::leave_guild()
* Create api/invites/mod.rs
* Add debug print to send_request
* Rename tests files
* Create invites.rs
* create invite.rs
* Add documentation
* Implement accept_invite
* Sort fields on Channel alphabetically
* Add invite mod
* Add forgotten teardown() at test end
* change visiblities, add create_user()
* Implement `create_user_invite()`
* start working on invite tests
* Add allow flags
* Fix bad url
* Create CreateChannelInviteSchema and friends
* remove non-implemented test code
* add body to requests
* Add Clone to UserMeta
* More comprehensive error message when running into a deserialization error
* Add arguments documentation to accept_invite
* Add Eq derive to GuildFeaturesList
* Add Eq derive to Emoji
* Add Eq derive to GuildBan
* Add create_accept_invite() test
* Add Default derive to ChannelCreateSchema
* Change create_guild_invite to return GuildInvite
* Dates as chrono::Date(Utc); sort alphabetically
* Add default derives wherever possible
* Implement add_- and remove_channel_recipient
* Create AddChannelRecipientSchema
* replace otheruser regs with bundle.creeate_user()
* Add (disabled) test remove_add_person_from_to_dm()
2023-07-17 19:36:28 +02:00
|
|
|
);
|
|
|
|
common::teardown(bundle).await;
|
|
|
|
}
|
|
|
|
|
|
|
|
// #[tokio::test]
|
2023-08-04 11:19:23 +02:00
|
|
|
// TODO This test currently is broken due to an issue with the Spacebar Server.
|
Join/Leave Guilds, (Group) DMs and minor improvements (#157)
## Summary:
**Added:**
- Schemas `PrivateChannelCreateSchema` `ChannelInviteCreateSchema`, `AddChannelRecipientSchema` recursively (including schemas which were needed to create these schemas)
- Methods `create_private_channel`, `leave_guild`, `accept_invite`, `create_user_invite`, `create_guild_invite`, `add_channel_recipient`, `remove_channel_recipient`
- Integration tests for the functionality covered by implementing #45
- Documentation in some places where I noticed it would be useful to have some
- `create_user` method in `/src/tests`: Cuts down on test boilerplate needed to create an addition test user
**Changed:**
- `.gitignore`
- Added `.DS_store` files to gitignore (some weird macos files), removed Cargo.lock, as Cargo.lock should be included for libraries
- Added a lot of default trait derives like Clone, Copy, PartialEq, Eq, Ord, PartialOrd to structs and enums where I saw them missing
- Added missing `teardown()` calls to the integration tests
- Renamed integration test files in `/src/tests` dir to all be plural: `channel.rs` -> `channels.rs`
- Made more fields on `User` type `Option<>`
- All instances in `/src/tests` where a second test user was created using a RegistrationSchema and the register_user method were replaced with the new `create_user` method
- README.md: Marked roadmap fields covered by #45 as implemented
- Changed visibility of `/src/tests/common/mod.rs` methods from `pub` to `pub(crate)`. In hindsight, this was probably not required, haha
**Removed:**
- Unneeded import in`src/types/config/types/guild_configuration.rs`
## Commit log:
* Add .DS_store, remove Cargo.lock
* Create PrivateChannelCreateSchema
* pub use users
* add channels.rs
* create channels.rs
* Add Deserialize/Serialize derives
* Implement create_private_channel
* Add create_dm() test
* Make optional fields on `User` `Option<>`
* Check boxes for implemented features
* Create users/guilds.rs
* Remove unneeded import
* Add UserMeta::leave_guild()
* Create api/invites/mod.rs
* Add debug print to send_request
* Rename tests files
* Create invites.rs
* create invite.rs
* Add documentation
* Implement accept_invite
* Sort fields on Channel alphabetically
* Add invite mod
* Add forgotten teardown() at test end
* change visiblities, add create_user()
* Implement `create_user_invite()`
* start working on invite tests
* Add allow flags
* Fix bad url
* Create CreateChannelInviteSchema and friends
* remove non-implemented test code
* add body to requests
* Add Clone to UserMeta
* More comprehensive error message when running into a deserialization error
* Add arguments documentation to accept_invite
* Add Eq derive to GuildFeaturesList
* Add Eq derive to Emoji
* Add Eq derive to GuildBan
* Add create_accept_invite() test
* Add Default derive to ChannelCreateSchema
* Change create_guild_invite to return GuildInvite
* Dates as chrono::Date(Utc); sort alphabetically
* Add default derives wherever possible
* Implement add_- and remove_channel_recipient
* Create AddChannelRecipientSchema
* replace otheruser regs with bundle.creeate_user()
* Add (disabled) test remove_add_person_from_to_dm()
2023-07-17 19:36:28 +02:00
|
|
|
#[allow(dead_code)]
|
|
|
|
async fn remove_add_person_from_to_dm() {
|
|
|
|
let mut bundle = common::setup().await;
|
|
|
|
let mut other_user = bundle.create_user("integrationtestuser2").await;
|
|
|
|
let mut third_user = bundle.create_user("integrationtestuser3").await;
|
2023-08-12 19:31:31 +02:00
|
|
|
let third_user_id = third_user.object.read().unwrap().id;
|
|
|
|
let other_user_id = other_user.object.read().unwrap().id;
|
|
|
|
let user_id = bundle.user.object.read().unwrap().id;
|
Join/Leave Guilds, (Group) DMs and minor improvements (#157)
## Summary:
**Added:**
- Schemas `PrivateChannelCreateSchema` `ChannelInviteCreateSchema`, `AddChannelRecipientSchema` recursively (including schemas which were needed to create these schemas)
- Methods `create_private_channel`, `leave_guild`, `accept_invite`, `create_user_invite`, `create_guild_invite`, `add_channel_recipient`, `remove_channel_recipient`
- Integration tests for the functionality covered by implementing #45
- Documentation in some places where I noticed it would be useful to have some
- `create_user` method in `/src/tests`: Cuts down on test boilerplate needed to create an addition test user
**Changed:**
- `.gitignore`
- Added `.DS_store` files to gitignore (some weird macos files), removed Cargo.lock, as Cargo.lock should be included for libraries
- Added a lot of default trait derives like Clone, Copy, PartialEq, Eq, Ord, PartialOrd to structs and enums where I saw them missing
- Added missing `teardown()` calls to the integration tests
- Renamed integration test files in `/src/tests` dir to all be plural: `channel.rs` -> `channels.rs`
- Made more fields on `User` type `Option<>`
- All instances in `/src/tests` where a second test user was created using a RegistrationSchema and the register_user method were replaced with the new `create_user` method
- README.md: Marked roadmap fields covered by #45 as implemented
- Changed visibility of `/src/tests/common/mod.rs` methods from `pub` to `pub(crate)`. In hindsight, this was probably not required, haha
**Removed:**
- Unneeded import in`src/types/config/types/guild_configuration.rs`
## Commit log:
* Add .DS_store, remove Cargo.lock
* Create PrivateChannelCreateSchema
* pub use users
* add channels.rs
* create channels.rs
* Add Deserialize/Serialize derives
* Implement create_private_channel
* Add create_dm() test
* Make optional fields on `User` `Option<>`
* Check boxes for implemented features
* Create users/guilds.rs
* Remove unneeded import
* Add UserMeta::leave_guild()
* Create api/invites/mod.rs
* Add debug print to send_request
* Rename tests files
* Create invites.rs
* create invite.rs
* Add documentation
* Implement accept_invite
* Sort fields on Channel alphabetically
* Add invite mod
* Add forgotten teardown() at test end
* change visiblities, add create_user()
* Implement `create_user_invite()`
* start working on invite tests
* Add allow flags
* Fix bad url
* Create CreateChannelInviteSchema and friends
* remove non-implemented test code
* add body to requests
* Add Clone to UserMeta
* More comprehensive error message when running into a deserialization error
* Add arguments documentation to accept_invite
* Add Eq derive to GuildFeaturesList
* Add Eq derive to Emoji
* Add Eq derive to GuildBan
* Add create_accept_invite() test
* Add Default derive to ChannelCreateSchema
* Change create_guild_invite to return GuildInvite
* Dates as chrono::Date(Utc); sort alphabetically
* Add default derives wherever possible
* Implement add_- and remove_channel_recipient
* Create AddChannelRecipientSchema
* replace otheruser regs with bundle.creeate_user()
* Add (disabled) test remove_add_person_from_to_dm()
2023-07-17 19:36:28 +02:00
|
|
|
let user = &mut bundle.user;
|
|
|
|
let private_channel_create_schema = PrivateChannelCreateSchema {
|
2023-08-04 11:19:23 +02:00
|
|
|
recipients: Some(Vec::from([other_user_id, third_user_id])),
|
Join/Leave Guilds, (Group) DMs and minor improvements (#157)
## Summary:
**Added:**
- Schemas `PrivateChannelCreateSchema` `ChannelInviteCreateSchema`, `AddChannelRecipientSchema` recursively (including schemas which were needed to create these schemas)
- Methods `create_private_channel`, `leave_guild`, `accept_invite`, `create_user_invite`, `create_guild_invite`, `add_channel_recipient`, `remove_channel_recipient`
- Integration tests for the functionality covered by implementing #45
- Documentation in some places where I noticed it would be useful to have some
- `create_user` method in `/src/tests`: Cuts down on test boilerplate needed to create an addition test user
**Changed:**
- `.gitignore`
- Added `.DS_store` files to gitignore (some weird macos files), removed Cargo.lock, as Cargo.lock should be included for libraries
- Added a lot of default trait derives like Clone, Copy, PartialEq, Eq, Ord, PartialOrd to structs and enums where I saw them missing
- Added missing `teardown()` calls to the integration tests
- Renamed integration test files in `/src/tests` dir to all be plural: `channel.rs` -> `channels.rs`
- Made more fields on `User` type `Option<>`
- All instances in `/src/tests` where a second test user was created using a RegistrationSchema and the register_user method were replaced with the new `create_user` method
- README.md: Marked roadmap fields covered by #45 as implemented
- Changed visibility of `/src/tests/common/mod.rs` methods from `pub` to `pub(crate)`. In hindsight, this was probably not required, haha
**Removed:**
- Unneeded import in`src/types/config/types/guild_configuration.rs`
## Commit log:
* Add .DS_store, remove Cargo.lock
* Create PrivateChannelCreateSchema
* pub use users
* add channels.rs
* create channels.rs
* Add Deserialize/Serialize derives
* Implement create_private_channel
* Add create_dm() test
* Make optional fields on `User` `Option<>`
* Check boxes for implemented features
* Create users/guilds.rs
* Remove unneeded import
* Add UserMeta::leave_guild()
* Create api/invites/mod.rs
* Add debug print to send_request
* Rename tests files
* Create invites.rs
* create invite.rs
* Add documentation
* Implement accept_invite
* Sort fields on Channel alphabetically
* Add invite mod
* Add forgotten teardown() at test end
* change visiblities, add create_user()
* Implement `create_user_invite()`
* start working on invite tests
* Add allow flags
* Fix bad url
* Create CreateChannelInviteSchema and friends
* remove non-implemented test code
* add body to requests
* Add Clone to UserMeta
* More comprehensive error message when running into a deserialization error
* Add arguments documentation to accept_invite
* Add Eq derive to GuildFeaturesList
* Add Eq derive to Emoji
* Add Eq derive to GuildBan
* Add create_accept_invite() test
* Add Default derive to ChannelCreateSchema
* Change create_guild_invite to return GuildInvite
* Dates as chrono::Date(Utc); sort alphabetically
* Add default derives wherever possible
* Implement add_- and remove_channel_recipient
* Create AddChannelRecipientSchema
* replace otheruser regs with bundle.creeate_user()
* Add (disabled) test remove_add_person_from_to_dm()
2023-07-17 19:36:28 +02:00
|
|
|
access_tokens: None,
|
|
|
|
nicks: None,
|
|
|
|
};
|
|
|
|
let dm_channel = user
|
|
|
|
.create_private_channel(private_channel_create_schema)
|
|
|
|
.await
|
|
|
|
.unwrap(); // Creates the Channel and stores the response Channel object
|
|
|
|
dm_channel
|
2023-08-04 11:19:23 +02:00
|
|
|
.remove_channel_recipient(other_user_id, user)
|
Join/Leave Guilds, (Group) DMs and minor improvements (#157)
## Summary:
**Added:**
- Schemas `PrivateChannelCreateSchema` `ChannelInviteCreateSchema`, `AddChannelRecipientSchema` recursively (including schemas which were needed to create these schemas)
- Methods `create_private_channel`, `leave_guild`, `accept_invite`, `create_user_invite`, `create_guild_invite`, `add_channel_recipient`, `remove_channel_recipient`
- Integration tests for the functionality covered by implementing #45
- Documentation in some places where I noticed it would be useful to have some
- `create_user` method in `/src/tests`: Cuts down on test boilerplate needed to create an addition test user
**Changed:**
- `.gitignore`
- Added `.DS_store` files to gitignore (some weird macos files), removed Cargo.lock, as Cargo.lock should be included for libraries
- Added a lot of default trait derives like Clone, Copy, PartialEq, Eq, Ord, PartialOrd to structs and enums where I saw them missing
- Added missing `teardown()` calls to the integration tests
- Renamed integration test files in `/src/tests` dir to all be plural: `channel.rs` -> `channels.rs`
- Made more fields on `User` type `Option<>`
- All instances in `/src/tests` where a second test user was created using a RegistrationSchema and the register_user method were replaced with the new `create_user` method
- README.md: Marked roadmap fields covered by #45 as implemented
- Changed visibility of `/src/tests/common/mod.rs` methods from `pub` to `pub(crate)`. In hindsight, this was probably not required, haha
**Removed:**
- Unneeded import in`src/types/config/types/guild_configuration.rs`
## Commit log:
* Add .DS_store, remove Cargo.lock
* Create PrivateChannelCreateSchema
* pub use users
* add channels.rs
* create channels.rs
* Add Deserialize/Serialize derives
* Implement create_private_channel
* Add create_dm() test
* Make optional fields on `User` `Option<>`
* Check boxes for implemented features
* Create users/guilds.rs
* Remove unneeded import
* Add UserMeta::leave_guild()
* Create api/invites/mod.rs
* Add debug print to send_request
* Rename tests files
* Create invites.rs
* create invite.rs
* Add documentation
* Implement accept_invite
* Sort fields on Channel alphabetically
* Add invite mod
* Add forgotten teardown() at test end
* change visiblities, add create_user()
* Implement `create_user_invite()`
* start working on invite tests
* Add allow flags
* Fix bad url
* Create CreateChannelInviteSchema and friends
* remove non-implemented test code
* add body to requests
* Add Clone to UserMeta
* More comprehensive error message when running into a deserialization error
* Add arguments documentation to accept_invite
* Add Eq derive to GuildFeaturesList
* Add Eq derive to Emoji
* Add Eq derive to GuildBan
* Add create_accept_invite() test
* Add Default derive to ChannelCreateSchema
* Change create_guild_invite to return GuildInvite
* Dates as chrono::Date(Utc); sort alphabetically
* Add default derives wherever possible
* Implement add_- and remove_channel_recipient
* Create AddChannelRecipientSchema
* replace otheruser regs with bundle.creeate_user()
* Add (disabled) test remove_add_person_from_to_dm()
2023-07-17 19:36:28 +02:00
|
|
|
.await
|
|
|
|
.unwrap();
|
|
|
|
assert!(dm_channel.recipients.as_ref().unwrap().get(1).is_none());
|
|
|
|
other_user
|
2023-08-04 11:19:23 +02:00
|
|
|
.modify_user_relationship(user_id, RelationshipType::Friends)
|
Join/Leave Guilds, (Group) DMs and minor improvements (#157)
## Summary:
**Added:**
- Schemas `PrivateChannelCreateSchema` `ChannelInviteCreateSchema`, `AddChannelRecipientSchema` recursively (including schemas which were needed to create these schemas)
- Methods `create_private_channel`, `leave_guild`, `accept_invite`, `create_user_invite`, `create_guild_invite`, `add_channel_recipient`, `remove_channel_recipient`
- Integration tests for the functionality covered by implementing #45
- Documentation in some places where I noticed it would be useful to have some
- `create_user` method in `/src/tests`: Cuts down on test boilerplate needed to create an addition test user
**Changed:**
- `.gitignore`
- Added `.DS_store` files to gitignore (some weird macos files), removed Cargo.lock, as Cargo.lock should be included for libraries
- Added a lot of default trait derives like Clone, Copy, PartialEq, Eq, Ord, PartialOrd to structs and enums where I saw them missing
- Added missing `teardown()` calls to the integration tests
- Renamed integration test files in `/src/tests` dir to all be plural: `channel.rs` -> `channels.rs`
- Made more fields on `User` type `Option<>`
- All instances in `/src/tests` where a second test user was created using a RegistrationSchema and the register_user method were replaced with the new `create_user` method
- README.md: Marked roadmap fields covered by #45 as implemented
- Changed visibility of `/src/tests/common/mod.rs` methods from `pub` to `pub(crate)`. In hindsight, this was probably not required, haha
**Removed:**
- Unneeded import in`src/types/config/types/guild_configuration.rs`
## Commit log:
* Add .DS_store, remove Cargo.lock
* Create PrivateChannelCreateSchema
* pub use users
* add channels.rs
* create channels.rs
* Add Deserialize/Serialize derives
* Implement create_private_channel
* Add create_dm() test
* Make optional fields on `User` `Option<>`
* Check boxes for implemented features
* Create users/guilds.rs
* Remove unneeded import
* Add UserMeta::leave_guild()
* Create api/invites/mod.rs
* Add debug print to send_request
* Rename tests files
* Create invites.rs
* create invite.rs
* Add documentation
* Implement accept_invite
* Sort fields on Channel alphabetically
* Add invite mod
* Add forgotten teardown() at test end
* change visiblities, add create_user()
* Implement `create_user_invite()`
* start working on invite tests
* Add allow flags
* Fix bad url
* Create CreateChannelInviteSchema and friends
* remove non-implemented test code
* add body to requests
* Add Clone to UserMeta
* More comprehensive error message when running into a deserialization error
* Add arguments documentation to accept_invite
* Add Eq derive to GuildFeaturesList
* Add Eq derive to Emoji
* Add Eq derive to GuildBan
* Add create_accept_invite() test
* Add Default derive to ChannelCreateSchema
* Change create_guild_invite to return GuildInvite
* Dates as chrono::Date(Utc); sort alphabetically
* Add default derives wherever possible
* Implement add_- and remove_channel_recipient
* Create AddChannelRecipientSchema
* replace otheruser regs with bundle.creeate_user()
* Add (disabled) test remove_add_person_from_to_dm()
2023-07-17 19:36:28 +02:00
|
|
|
.await
|
|
|
|
.unwrap();
|
2023-08-04 11:19:23 +02:00
|
|
|
user.modify_user_relationship(other_user_id, RelationshipType::Friends)
|
Join/Leave Guilds, (Group) DMs and minor improvements (#157)
## Summary:
**Added:**
- Schemas `PrivateChannelCreateSchema` `ChannelInviteCreateSchema`, `AddChannelRecipientSchema` recursively (including schemas which were needed to create these schemas)
- Methods `create_private_channel`, `leave_guild`, `accept_invite`, `create_user_invite`, `create_guild_invite`, `add_channel_recipient`, `remove_channel_recipient`
- Integration tests for the functionality covered by implementing #45
- Documentation in some places where I noticed it would be useful to have some
- `create_user` method in `/src/tests`: Cuts down on test boilerplate needed to create an addition test user
**Changed:**
- `.gitignore`
- Added `.DS_store` files to gitignore (some weird macos files), removed Cargo.lock, as Cargo.lock should be included for libraries
- Added a lot of default trait derives like Clone, Copy, PartialEq, Eq, Ord, PartialOrd to structs and enums where I saw them missing
- Added missing `teardown()` calls to the integration tests
- Renamed integration test files in `/src/tests` dir to all be plural: `channel.rs` -> `channels.rs`
- Made more fields on `User` type `Option<>`
- All instances in `/src/tests` where a second test user was created using a RegistrationSchema and the register_user method were replaced with the new `create_user` method
- README.md: Marked roadmap fields covered by #45 as implemented
- Changed visibility of `/src/tests/common/mod.rs` methods from `pub` to `pub(crate)`. In hindsight, this was probably not required, haha
**Removed:**
- Unneeded import in`src/types/config/types/guild_configuration.rs`
## Commit log:
* Add .DS_store, remove Cargo.lock
* Create PrivateChannelCreateSchema
* pub use users
* add channels.rs
* create channels.rs
* Add Deserialize/Serialize derives
* Implement create_private_channel
* Add create_dm() test
* Make optional fields on `User` `Option<>`
* Check boxes for implemented features
* Create users/guilds.rs
* Remove unneeded import
* Add UserMeta::leave_guild()
* Create api/invites/mod.rs
* Add debug print to send_request
* Rename tests files
* Create invites.rs
* create invite.rs
* Add documentation
* Implement accept_invite
* Sort fields on Channel alphabetically
* Add invite mod
* Add forgotten teardown() at test end
* change visiblities, add create_user()
* Implement `create_user_invite()`
* start working on invite tests
* Add allow flags
* Fix bad url
* Create CreateChannelInviteSchema and friends
* remove non-implemented test code
* add body to requests
* Add Clone to UserMeta
* More comprehensive error message when running into a deserialization error
* Add arguments documentation to accept_invite
* Add Eq derive to GuildFeaturesList
* Add Eq derive to Emoji
* Add Eq derive to GuildBan
* Add create_accept_invite() test
* Add Default derive to ChannelCreateSchema
* Change create_guild_invite to return GuildInvite
* Dates as chrono::Date(Utc); sort alphabetically
* Add default derives wherever possible
* Implement add_- and remove_channel_recipient
* Create AddChannelRecipientSchema
* replace otheruser regs with bundle.creeate_user()
* Add (disabled) test remove_add_person_from_to_dm()
2023-07-17 19:36:28 +02:00
|
|
|
.await
|
|
|
|
.unwrap();
|
|
|
|
third_user
|
2023-08-04 11:19:23 +02:00
|
|
|
.modify_user_relationship(user_id, RelationshipType::Friends)
|
Join/Leave Guilds, (Group) DMs and minor improvements (#157)
## Summary:
**Added:**
- Schemas `PrivateChannelCreateSchema` `ChannelInviteCreateSchema`, `AddChannelRecipientSchema` recursively (including schemas which were needed to create these schemas)
- Methods `create_private_channel`, `leave_guild`, `accept_invite`, `create_user_invite`, `create_guild_invite`, `add_channel_recipient`, `remove_channel_recipient`
- Integration tests for the functionality covered by implementing #45
- Documentation in some places where I noticed it would be useful to have some
- `create_user` method in `/src/tests`: Cuts down on test boilerplate needed to create an addition test user
**Changed:**
- `.gitignore`
- Added `.DS_store` files to gitignore (some weird macos files), removed Cargo.lock, as Cargo.lock should be included for libraries
- Added a lot of default trait derives like Clone, Copy, PartialEq, Eq, Ord, PartialOrd to structs and enums where I saw them missing
- Added missing `teardown()` calls to the integration tests
- Renamed integration test files in `/src/tests` dir to all be plural: `channel.rs` -> `channels.rs`
- Made more fields on `User` type `Option<>`
- All instances in `/src/tests` where a second test user was created using a RegistrationSchema and the register_user method were replaced with the new `create_user` method
- README.md: Marked roadmap fields covered by #45 as implemented
- Changed visibility of `/src/tests/common/mod.rs` methods from `pub` to `pub(crate)`. In hindsight, this was probably not required, haha
**Removed:**
- Unneeded import in`src/types/config/types/guild_configuration.rs`
## Commit log:
* Add .DS_store, remove Cargo.lock
* Create PrivateChannelCreateSchema
* pub use users
* add channels.rs
* create channels.rs
* Add Deserialize/Serialize derives
* Implement create_private_channel
* Add create_dm() test
* Make optional fields on `User` `Option<>`
* Check boxes for implemented features
* Create users/guilds.rs
* Remove unneeded import
* Add UserMeta::leave_guild()
* Create api/invites/mod.rs
* Add debug print to send_request
* Rename tests files
* Create invites.rs
* create invite.rs
* Add documentation
* Implement accept_invite
* Sort fields on Channel alphabetically
* Add invite mod
* Add forgotten teardown() at test end
* change visiblities, add create_user()
* Implement `create_user_invite()`
* start working on invite tests
* Add allow flags
* Fix bad url
* Create CreateChannelInviteSchema and friends
* remove non-implemented test code
* add body to requests
* Add Clone to UserMeta
* More comprehensive error message when running into a deserialization error
* Add arguments documentation to accept_invite
* Add Eq derive to GuildFeaturesList
* Add Eq derive to Emoji
* Add Eq derive to GuildBan
* Add create_accept_invite() test
* Add Default derive to ChannelCreateSchema
* Change create_guild_invite to return GuildInvite
* Dates as chrono::Date(Utc); sort alphabetically
* Add default derives wherever possible
* Implement add_- and remove_channel_recipient
* Create AddChannelRecipientSchema
* replace otheruser regs with bundle.creeate_user()
* Add (disabled) test remove_add_person_from_to_dm()
2023-07-17 19:36:28 +02:00
|
|
|
.await
|
|
|
|
.unwrap();
|
2023-08-04 11:19:23 +02:00
|
|
|
user.modify_user_relationship(third_user_id, RelationshipType::Friends)
|
Join/Leave Guilds, (Group) DMs and minor improvements (#157)
## Summary:
**Added:**
- Schemas `PrivateChannelCreateSchema` `ChannelInviteCreateSchema`, `AddChannelRecipientSchema` recursively (including schemas which were needed to create these schemas)
- Methods `create_private_channel`, `leave_guild`, `accept_invite`, `create_user_invite`, `create_guild_invite`, `add_channel_recipient`, `remove_channel_recipient`
- Integration tests for the functionality covered by implementing #45
- Documentation in some places where I noticed it would be useful to have some
- `create_user` method in `/src/tests`: Cuts down on test boilerplate needed to create an addition test user
**Changed:**
- `.gitignore`
- Added `.DS_store` files to gitignore (some weird macos files), removed Cargo.lock, as Cargo.lock should be included for libraries
- Added a lot of default trait derives like Clone, Copy, PartialEq, Eq, Ord, PartialOrd to structs and enums where I saw them missing
- Added missing `teardown()` calls to the integration tests
- Renamed integration test files in `/src/tests` dir to all be plural: `channel.rs` -> `channels.rs`
- Made more fields on `User` type `Option<>`
- All instances in `/src/tests` where a second test user was created using a RegistrationSchema and the register_user method were replaced with the new `create_user` method
- README.md: Marked roadmap fields covered by #45 as implemented
- Changed visibility of `/src/tests/common/mod.rs` methods from `pub` to `pub(crate)`. In hindsight, this was probably not required, haha
**Removed:**
- Unneeded import in`src/types/config/types/guild_configuration.rs`
## Commit log:
* Add .DS_store, remove Cargo.lock
* Create PrivateChannelCreateSchema
* pub use users
* add channels.rs
* create channels.rs
* Add Deserialize/Serialize derives
* Implement create_private_channel
* Add create_dm() test
* Make optional fields on `User` `Option<>`
* Check boxes for implemented features
* Create users/guilds.rs
* Remove unneeded import
* Add UserMeta::leave_guild()
* Create api/invites/mod.rs
* Add debug print to send_request
* Rename tests files
* Create invites.rs
* create invite.rs
* Add documentation
* Implement accept_invite
* Sort fields on Channel alphabetically
* Add invite mod
* Add forgotten teardown() at test end
* change visiblities, add create_user()
* Implement `create_user_invite()`
* start working on invite tests
* Add allow flags
* Fix bad url
* Create CreateChannelInviteSchema and friends
* remove non-implemented test code
* add body to requests
* Add Clone to UserMeta
* More comprehensive error message when running into a deserialization error
* Add arguments documentation to accept_invite
* Add Eq derive to GuildFeaturesList
* Add Eq derive to Emoji
* Add Eq derive to GuildBan
* Add create_accept_invite() test
* Add Default derive to ChannelCreateSchema
* Change create_guild_invite to return GuildInvite
* Dates as chrono::Date(Utc); sort alphabetically
* Add default derives wherever possible
* Implement add_- and remove_channel_recipient
* Create AddChannelRecipientSchema
* replace otheruser regs with bundle.creeate_user()
* Add (disabled) test remove_add_person_from_to_dm()
2023-07-17 19:36:28 +02:00
|
|
|
.await
|
|
|
|
.unwrap();
|
|
|
|
// Users 1-2 and 1-3 are now friends
|
|
|
|
dm_channel
|
2023-08-04 11:19:23 +02:00
|
|
|
.add_channel_recipient(other_user_id, user, None)
|
Join/Leave Guilds, (Group) DMs and minor improvements (#157)
## Summary:
**Added:**
- Schemas `PrivateChannelCreateSchema` `ChannelInviteCreateSchema`, `AddChannelRecipientSchema` recursively (including schemas which were needed to create these schemas)
- Methods `create_private_channel`, `leave_guild`, `accept_invite`, `create_user_invite`, `create_guild_invite`, `add_channel_recipient`, `remove_channel_recipient`
- Integration tests for the functionality covered by implementing #45
- Documentation in some places where I noticed it would be useful to have some
- `create_user` method in `/src/tests`: Cuts down on test boilerplate needed to create an addition test user
**Changed:**
- `.gitignore`
- Added `.DS_store` files to gitignore (some weird macos files), removed Cargo.lock, as Cargo.lock should be included for libraries
- Added a lot of default trait derives like Clone, Copy, PartialEq, Eq, Ord, PartialOrd to structs and enums where I saw them missing
- Added missing `teardown()` calls to the integration tests
- Renamed integration test files in `/src/tests` dir to all be plural: `channel.rs` -> `channels.rs`
- Made more fields on `User` type `Option<>`
- All instances in `/src/tests` where a second test user was created using a RegistrationSchema and the register_user method were replaced with the new `create_user` method
- README.md: Marked roadmap fields covered by #45 as implemented
- Changed visibility of `/src/tests/common/mod.rs` methods from `pub` to `pub(crate)`. In hindsight, this was probably not required, haha
**Removed:**
- Unneeded import in`src/types/config/types/guild_configuration.rs`
## Commit log:
* Add .DS_store, remove Cargo.lock
* Create PrivateChannelCreateSchema
* pub use users
* add channels.rs
* create channels.rs
* Add Deserialize/Serialize derives
* Implement create_private_channel
* Add create_dm() test
* Make optional fields on `User` `Option<>`
* Check boxes for implemented features
* Create users/guilds.rs
* Remove unneeded import
* Add UserMeta::leave_guild()
* Create api/invites/mod.rs
* Add debug print to send_request
* Rename tests files
* Create invites.rs
* create invite.rs
* Add documentation
* Implement accept_invite
* Sort fields on Channel alphabetically
* Add invite mod
* Add forgotten teardown() at test end
* change visiblities, add create_user()
* Implement `create_user_invite()`
* start working on invite tests
* Add allow flags
* Fix bad url
* Create CreateChannelInviteSchema and friends
* remove non-implemented test code
* add body to requests
* Add Clone to UserMeta
* More comprehensive error message when running into a deserialization error
* Add arguments documentation to accept_invite
* Add Eq derive to GuildFeaturesList
* Add Eq derive to Emoji
* Add Eq derive to GuildBan
* Add create_accept_invite() test
* Add Default derive to ChannelCreateSchema
* Change create_guild_invite to return GuildInvite
* Dates as chrono::Date(Utc); sort alphabetically
* Add default derives wherever possible
* Implement add_- and remove_channel_recipient
* Create AddChannelRecipientSchema
* replace otheruser regs with bundle.creeate_user()
* Add (disabled) test remove_add_person_from_to_dm()
2023-07-17 19:36:28 +02:00
|
|
|
.await
|
|
|
|
.unwrap();
|
|
|
|
assert!(dm_channel.recipients.is_some());
|
|
|
|
assert_eq!(
|
2023-08-04 11:19:23 +02:00
|
|
|
dm_channel
|
|
|
|
.recipients
|
|
|
|
.as_ref()
|
2024-07-18 23:04:35 +02:00
|
|
|
.unwrap().first()
|
2023-08-04 11:19:23 +02:00
|
|
|
.unwrap()
|
2023-08-12 19:31:31 +02:00
|
|
|
.read()
|
2023-08-04 11:19:23 +02:00
|
|
|
.unwrap()
|
|
|
|
.id,
|
|
|
|
other_user_id
|
Join/Leave Guilds, (Group) DMs and minor improvements (#157)
## Summary:
**Added:**
- Schemas `PrivateChannelCreateSchema` `ChannelInviteCreateSchema`, `AddChannelRecipientSchema` recursively (including schemas which were needed to create these schemas)
- Methods `create_private_channel`, `leave_guild`, `accept_invite`, `create_user_invite`, `create_guild_invite`, `add_channel_recipient`, `remove_channel_recipient`
- Integration tests for the functionality covered by implementing #45
- Documentation in some places where I noticed it would be useful to have some
- `create_user` method in `/src/tests`: Cuts down on test boilerplate needed to create an addition test user
**Changed:**
- `.gitignore`
- Added `.DS_store` files to gitignore (some weird macos files), removed Cargo.lock, as Cargo.lock should be included for libraries
- Added a lot of default trait derives like Clone, Copy, PartialEq, Eq, Ord, PartialOrd to structs and enums where I saw them missing
- Added missing `teardown()` calls to the integration tests
- Renamed integration test files in `/src/tests` dir to all be plural: `channel.rs` -> `channels.rs`
- Made more fields on `User` type `Option<>`
- All instances in `/src/tests` where a second test user was created using a RegistrationSchema and the register_user method were replaced with the new `create_user` method
- README.md: Marked roadmap fields covered by #45 as implemented
- Changed visibility of `/src/tests/common/mod.rs` methods from `pub` to `pub(crate)`. In hindsight, this was probably not required, haha
**Removed:**
- Unneeded import in`src/types/config/types/guild_configuration.rs`
## Commit log:
* Add .DS_store, remove Cargo.lock
* Create PrivateChannelCreateSchema
* pub use users
* add channels.rs
* create channels.rs
* Add Deserialize/Serialize derives
* Implement create_private_channel
* Add create_dm() test
* Make optional fields on `User` `Option<>`
* Check boxes for implemented features
* Create users/guilds.rs
* Remove unneeded import
* Add UserMeta::leave_guild()
* Create api/invites/mod.rs
* Add debug print to send_request
* Rename tests files
* Create invites.rs
* create invite.rs
* Add documentation
* Implement accept_invite
* Sort fields on Channel alphabetically
* Add invite mod
* Add forgotten teardown() at test end
* change visiblities, add create_user()
* Implement `create_user_invite()`
* start working on invite tests
* Add allow flags
* Fix bad url
* Create CreateChannelInviteSchema and friends
* remove non-implemented test code
* add body to requests
* Add Clone to UserMeta
* More comprehensive error message when running into a deserialization error
* Add arguments documentation to accept_invite
* Add Eq derive to GuildFeaturesList
* Add Eq derive to Emoji
* Add Eq derive to GuildBan
* Add create_accept_invite() test
* Add Default derive to ChannelCreateSchema
* Change create_guild_invite to return GuildInvite
* Dates as chrono::Date(Utc); sort alphabetically
* Add default derives wherever possible
* Implement add_- and remove_channel_recipient
* Create AddChannelRecipientSchema
* replace otheruser regs with bundle.creeate_user()
* Add (disabled) test remove_add_person_from_to_dm()
2023-07-17 19:36:28 +02:00
|
|
|
);
|
|
|
|
assert_eq!(
|
2023-08-04 11:19:23 +02:00
|
|
|
dm_channel
|
|
|
|
.recipients
|
|
|
|
.as_ref()
|
|
|
|
.unwrap()
|
|
|
|
.get(1)
|
|
|
|
.unwrap()
|
2023-08-12 19:31:31 +02:00
|
|
|
.read()
|
2023-08-04 11:19:23 +02:00
|
|
|
.unwrap()
|
|
|
|
.id,
|
|
|
|
user_id
|
Join/Leave Guilds, (Group) DMs and minor improvements (#157)
## Summary:
**Added:**
- Schemas `PrivateChannelCreateSchema` `ChannelInviteCreateSchema`, `AddChannelRecipientSchema` recursively (including schemas which were needed to create these schemas)
- Methods `create_private_channel`, `leave_guild`, `accept_invite`, `create_user_invite`, `create_guild_invite`, `add_channel_recipient`, `remove_channel_recipient`
- Integration tests for the functionality covered by implementing #45
- Documentation in some places where I noticed it would be useful to have some
- `create_user` method in `/src/tests`: Cuts down on test boilerplate needed to create an addition test user
**Changed:**
- `.gitignore`
- Added `.DS_store` files to gitignore (some weird macos files), removed Cargo.lock, as Cargo.lock should be included for libraries
- Added a lot of default trait derives like Clone, Copy, PartialEq, Eq, Ord, PartialOrd to structs and enums where I saw them missing
- Added missing `teardown()` calls to the integration tests
- Renamed integration test files in `/src/tests` dir to all be plural: `channel.rs` -> `channels.rs`
- Made more fields on `User` type `Option<>`
- All instances in `/src/tests` where a second test user was created using a RegistrationSchema and the register_user method were replaced with the new `create_user` method
- README.md: Marked roadmap fields covered by #45 as implemented
- Changed visibility of `/src/tests/common/mod.rs` methods from `pub` to `pub(crate)`. In hindsight, this was probably not required, haha
**Removed:**
- Unneeded import in`src/types/config/types/guild_configuration.rs`
## Commit log:
* Add .DS_store, remove Cargo.lock
* Create PrivateChannelCreateSchema
* pub use users
* add channels.rs
* create channels.rs
* Add Deserialize/Serialize derives
* Implement create_private_channel
* Add create_dm() test
* Make optional fields on `User` `Option<>`
* Check boxes for implemented features
* Create users/guilds.rs
* Remove unneeded import
* Add UserMeta::leave_guild()
* Create api/invites/mod.rs
* Add debug print to send_request
* Rename tests files
* Create invites.rs
* create invite.rs
* Add documentation
* Implement accept_invite
* Sort fields on Channel alphabetically
* Add invite mod
* Add forgotten teardown() at test end
* change visiblities, add create_user()
* Implement `create_user_invite()`
* start working on invite tests
* Add allow flags
* Fix bad url
* Create CreateChannelInviteSchema and friends
* remove non-implemented test code
* add body to requests
* Add Clone to UserMeta
* More comprehensive error message when running into a deserialization error
* Add arguments documentation to accept_invite
* Add Eq derive to GuildFeaturesList
* Add Eq derive to Emoji
* Add Eq derive to GuildBan
* Add create_accept_invite() test
* Add Default derive to ChannelCreateSchema
* Change create_guild_invite to return GuildInvite
* Dates as chrono::Date(Utc); sort alphabetically
* Add default derives wherever possible
* Implement add_- and remove_channel_recipient
* Create AddChannelRecipientSchema
* replace otheruser regs with bundle.creeate_user()
* Add (disabled) test remove_add_person_from_to_dm()
2023-07-17 19:36:28 +02:00
|
|
|
);
|
|
|
|
}
|