Add regression test for issue 473

This commit is contained in:
Maybe Waffle 2021-11-20 19:33:22 +03:00
parent 3ccf624168
commit c4b148459d
2 changed files with 20 additions and 0 deletions

View file

@ -58,6 +58,7 @@ bitflags = { version = "1.2", optional = true }
[dev-dependencies]
pretty_env_logger = "0.4"
tokio = { version = "1.8.0", features = ["fs", "macros"] }
[features]
default = ["native-tls"]

View file

@ -29,3 +29,22 @@ pub(crate) fn to_form<T: ?Sized + Serialize>(val: &T) -> impl Future<Output = Re
let fut = val.serialize(MultipartTopLvlSerializer {});
async { Ok(fut?.await?) }
}
// https://github.com/teloxide/teloxide/issues/473
#[tokio::test]
async fn issue_473() {
use crate::{
payloads::{self, SendPhotoSetters},
types::{InputFile, MessageEntity, MessageEntityKind},
};
to_form(
&payloads::SendPhoto::new(0, InputFile::file_id("0")).caption_entities([MessageEntity {
kind: MessageEntityKind::Url,
offset: 0,
length: 0,
}]),
)
.await
.unwrap();
}