aboutsummaryrefslogtreecommitdiff
path: root/tests/test_user.rs
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-12-15 12:46:27 -0800
committerAustin Hellyer <[email protected]>2016-12-15 12:46:27 -0800
commit0708ccf85bac347e59053133a2b8b6f2eabe99ba (patch)
tree1deab8231d48b05495c08d34b0d7eace954a0a6a /tests/test_user.rs
parentRelease v0.1.3 for some hotfixes (diff)
downloadserenity-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.rs24
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());
+}