diff options
| author | Austin Hellyer <[email protected]> | 2016-12-15 12:46:27 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-12-15 12:46:27 -0800 |
| commit | 0708ccf85bac347e59053133a2b8b6f2eabe99ba (patch) | |
| tree | 1deab8231d48b05495c08d34b0d7eace954a0a6a /tests/test_user.rs | |
| parent | Release v0.1.3 for some hotfixes (diff) | |
| download | serenity-0708ccf85bac347e59053133a2b8b6f2eabe99ba.tar.xz serenity-0708ccf85bac347e59053133a2b8b6f2eabe99ba.zip | |
Fix User::avatar_url + add Id display tests
User::avatar_url was formatting the user's Id as a mention, rather than
the inner u64.
Diffstat (limited to 'tests/test_user.rs')
| -rw-r--r-- | tests/test_user.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_user.rs b/tests/test_user.rs new file mode 100644 index 0000000..b4509f3 --- /dev/null +++ b/tests/test_user.rs @@ -0,0 +1,24 @@ +extern crate serenity; + +use serenity::model::{User, UserId}; + +fn gen() -> User { + User { + id: UserId(210), + avatar: Some("abc".to_owned()), + bot: true, + discriminator: "1432".to_owned(), + name: "test".to_owned(), + } +} + +#[test] +fn test_core() { + let mut user = gen(); + + assert!(user.avatar_url().unwrap().ends_with("/avatars/210/abc.jpg")); + + user.avatar = None; + + assert!(user.avatar_url().is_none()); +} |