mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-11 04:21:12 +01:00
Add regression test for WebhookInfo
with an empty url
This commit is contained in:
parent
a36794c5d3
commit
16630133db
1 changed files with 22 additions and 0 deletions
|
@ -42,3 +42,25 @@ pub struct WebhookInfo {
|
|||
/// types.
|
||||
pub allowed_updates: Option<Vec<AllowedUpdate>>,
|
||||
}
|
||||
|
||||
// Regression test for <https://github.com/teloxide/teloxide-core/pull/166>
|
||||
#[test]
|
||||
fn empty_url() {
|
||||
let json = r#"{"url":"","has_custom_certificate":false,"pending_update_count":0,"allowed_updates":["message"]}"#;
|
||||
let actual: WebhookInfo = serde_json::from_str(json).unwrap();
|
||||
let expected = WebhookInfo {
|
||||
url: None,
|
||||
has_custom_certificate: false,
|
||||
pending_update_count: 0,
|
||||
ip_address: None,
|
||||
last_error_date: None,
|
||||
last_error_message: None,
|
||||
max_connections: None,
|
||||
allowed_updates: Some(vec![AllowedUpdate::Message]),
|
||||
};
|
||||
|
||||
assert_eq!(actual, expected);
|
||||
|
||||
let json = r#"{"ok":true,"result":{"url":"","has_custom_certificate":false,"pending_update_count":0,"allowed_updates":["message"]}}"#;
|
||||
serde_json::from_str::<crate::net::TelegramResponse<WebhookInfo>>(json).unwrap();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue