Wire iOS media downloads through session bridge
This commit is contained in:
@@ -942,7 +942,8 @@ mod tests {
|
||||
.build();
|
||||
let client = FakeTdClient::new()
|
||||
.with_message(chat_id.as_i64(), message)
|
||||
.with_downloaded_file(77, "/tmp/photo.jpg");
|
||||
.with_downloaded_file(77, "/tmp/photo.jpg")
|
||||
.with_downloaded_file(88, "/tmp/voice.ogg");
|
||||
let mut session = CoreSession::new(client);
|
||||
|
||||
session
|
||||
@@ -960,8 +961,10 @@ mod tests {
|
||||
.await
|
||||
.unwrap();
|
||||
let downloaded = session.download_photo(77).await.unwrap();
|
||||
let downloaded_voice = session.download_voice(88).await.unwrap();
|
||||
|
||||
assert_eq!(downloaded.path, "/tmp/photo.jpg");
|
||||
assert_eq!(downloaded_voice.path, "/tmp/voice.ogg");
|
||||
assert_eq!(session.client().get_forwarded_messages().len(), 1);
|
||||
assert_eq!(
|
||||
reactions,
|
||||
|
||||
@@ -308,7 +308,7 @@ impl FileClient for FakeTdClient {
|
||||
}
|
||||
|
||||
async fn download_voice_note(&self, file_id: i32) -> Result<String, String> {
|
||||
Ok(format!("/tmp/fake_voice_{}.ogg", file_id))
|
||||
FakeTdClient::download_file(self, file_id).await
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1301,6 +1301,8 @@ mod tests {
|
||||
assert_eq!(history[0].text, "Hello from fake TDLib");
|
||||
let pinned = session.pinned_messages(chats[0].id).unwrap();
|
||||
assert_eq!(pinned[0].text, "Hello from fake TDLib");
|
||||
assert_eq!(session.download_photo(100).unwrap().path, "/tmp/fake-photo.jpg");
|
||||
assert_eq!(session.download_voice(200).unwrap().path, "/tmp/fake-voice.ogg");
|
||||
|
||||
let sent = session
|
||||
.send_message(chats[0].id, "Hi from Swift".to_string(), None)
|
||||
|
||||
Reference in New Issue
Block a user