From 6945ff11330236a7b36d78bd147ac9070c05f59e Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Sun, 26 Jun 2022 23:36:02 +0400 Subject: [PATCH] fix tests --- src/net/download.rs | 2 +- src/types/callback_query.rs | 2 ++ src/types/chat_member.rs | 2 ++ src/types/file.rs | 2 +- src/types/me.rs | 1 + src/types/message.rs | 2 ++ src/types/update.rs | 2 ++ src/types/user.rs | 3 +++ 8 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/net/download.rs b/src/net/download.rs index da05352d..394af6fe 100644 --- a/src/net/download.rs +++ b/src/net/download.rs @@ -44,7 +44,7 @@ pub trait Download<'w> /// /// let TgFile { file_path, .. } = bot.get_file("*file_id*").send().await?; /// let mut file = File::create("/tmp/test.png").await?; - /// bot.download_file(&file_path, &mut file).await?; + /// bot.download_file(&file_path.unwrap(), &mut file).await?; /// # Ok(()) } /// ``` /// diff --git a/src/types/callback_query.rs b/src/types/callback_query.rs index 92d2f920..5cfa0fa8 100644 --- a/src/types/callback_query.rs +++ b/src/types/callback_query.rs @@ -78,6 +78,8 @@ mod tests { last_name: None, username: None, language_code: None, + is_premium: false, + added_to_attachment_menu: false, }, chat_instance: "123456".to_string(), message: None, diff --git a/src/types/chat_member.rs b/src/types/chat_member.rs index 405a31f6..7ddc7a77 100644 --- a/src/types/chat_member.rs +++ b/src/types/chat_member.rs @@ -704,6 +704,8 @@ mod tests { last_name: Some("Last".to_string()), username: Some("fl".to_string()), language_code: Some("en".to_string()), + is_premium: false, + added_to_attachment_menu: false, }, kind: ChatMemberKind::Administrator(Administrator { custom_title: None, diff --git a/src/types/file.rs b/src/types/file.rs index 9dfb5860..ba132755 100644 --- a/src/types/file.rs +++ b/src/types/file.rs @@ -62,7 +62,7 @@ mod tests { file_id: "FILE_ID".to_owned(), file_unique_id: "FILE_UNIQUE_ID".to_owned(), file_size: Some(42), - file_path: Some("".to_owned()), + file_path: None, } ); } diff --git a/src/types/me.rs b/src/types/me.rs index b0d82b8c..2d101558 100644 --- a/src/types/me.rs +++ b/src/types/me.rs @@ -67,6 +67,7 @@ mod tests { username: Some("SomethingSomethingBot".to_owned()), language_code: None, is_premium: false, + added_to_attachment_menu: false, }, can_join_groups: false, can_read_all_group_messages: false, diff --git a/src/types/message.rs b/src/types/message.rs index db798fa6..666c206c 100644 --- a/src/types/message.rs +++ b/src/types/message.rs @@ -1511,6 +1511,8 @@ mod tests { slow_mode_delay: None, linked_chat_id: None, location: None, + join_by_request: None, + join_to_send_messages: None, }), description: None, invite_link: None, diff --git a/src/types/update.rs b/src/types/update.rs index 0e9d1378..81f35224 100644 --- a/src/types/update.rs +++ b/src/types/update.rs @@ -355,6 +355,8 @@ mod test { last_name: None, username: Some(String::from("WaffleLapkin")), language_code: Some(String::from("en")), + is_premium: false, + added_to_attachment_menu: false, }), reply_to_message: None, forward: None, diff --git a/src/types/user.rs b/src/types/user.rs index 78b1f617..7d155464 100644 --- a/src/types/user.rs +++ b/src/types/user.rs @@ -146,6 +146,7 @@ mod tests { username: Some("Username".to_string()), language_code: Some(String::from("ru")), is_premium: false, + added_to_attachment_menu: false, }; let actual = serde_json::from_str::(json).unwrap(); assert_eq!(actual, expected) @@ -161,6 +162,7 @@ mod tests { username: Some("aaaaaaaaaaaaaaaa".to_owned()), language_code: None, is_premium: false, + added_to_attachment_menu: false, }; let user_b = User { @@ -171,6 +173,7 @@ mod tests { username: None, language_code: None, is_premium: false, + added_to_attachment_menu: false, }; assert_eq!(user_a.full_name(), "First Last");