diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2020-09-16 19:57:06 +0300 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2020-09-16 19:57:06 +0300 |
commit | 83bee279e65f9997dd30a2a04130adc052a83005 (patch) | |
tree | d97d403a22e24d0fce999b95df3954f4d87f36a3 /tests | |
parent | e8f3b6aa24b33f79b04a16b424284bc3ac752808 (diff) |
melib/email/compose: set attachment status
Set Content-Disposition: attachment to, well, attachments.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/generated_email.eml (renamed from tests/generated.mail) | 35 | ||||
-rw-r--r-- | tests/generating_email.rs | 13 |
2 files changed, 20 insertions, 28 deletions
diff --git a/tests/generated.mail b/tests/generated_email.eml index 20f23ff0..357d754b 100644 --- a/tests/generated.mail +++ b/tests/generated_email.eml @@ -1,19 +1,20 @@ -Subject: -From: -To: -Cc: -Bcc: -MIME-Version: 1.0 -Content-Type: multipart/mixed; charset="utf-8"; boundary="bzz_bzz__bzz__" - -This is a MIME formatted message with attachments. Use a MIME-compliant client to view it properly. ---bzz_bzz__bzz__ - -hello world. ---bzz_bzz__bzz__ -Content-Type: image/gif; name="test_image.gif"; charset="utf-8" -Content-Transfer-Encoding: base64 - +Subject:
+From:
+To:
+Cc:
+Bcc:
+MIME-Version: 1.0
+Content-Type: multipart/mixed; charset="utf-8"; boundary="bzz_bzz__bzz__"
+
+This is a MIME formatted message with attachments. Use a MIME-compliant client to view it properly.
+--bzz_bzz__bzz__
+
+hello world.
+--bzz_bzz__bzz__
+Content-Type: image/gif; name="test_image.gif"; charset="utf-8"
+Content-Disposition: attachment
+Content-Transfer-Encoding: base64
+
R0lGODdhKAAXAOfZAAABzAADzQAEzgQFtBEAxAAGxBcAxwALvRcFwAAPwBcLugATuQEUuxoNuxYQ
sxwOvAYVvBsStSAVtx8YsRUcuhwhth4iuCQsyDAwuDc1vTc3uDg4uT85rkc9ukJBvENCvURGukdF
wUVKt0hLuUxPvVZSvFlYu1hbt2BZuFxdul5joGhqlnNuf3FvlnBvwXJyt3Jxw3N0oXx1gH12gV99
@@ -36,5 +37,5 @@ Ob+jG0YVRBErUrOiiGJ8KxgtYsh27xWL/tswnTtEbsiRVYdJNMHk4yOGhswGjR88UKjQ9Ey+/8TL XKKGGn7Akph/8XX2WDTTcAYfguVt9hhrEPqmzIOJ3VUheb48WJiHG6amC4i+WVJKKCimqGIoYxyj
WWK8kKjaJ9bA18sxvXjYhourmbbMMrjI+OIn1QymDCVXANGFK4S1gQw0PxozzC+33FLLKUJq9gk1
gyWDhyNwrMLkYGUEM4wvuLRiCiieXIJJJVlmJskcZ9TZRht1lnFGGmTMkMoonVQSSSOFAGJHHI0w
-ouiijDaaCCGQRgrpH3q4QYYXWDihxBE+7KCDDjnUIEVAADs= +ouiijDaaCCGQRgrpH3q4QYYXWDihxBE+7KCDDjnUIEVAADs=
--bzz_bzz__bzz__-- diff --git a/tests/generating_email.rs b/tests/generating_email.rs index e44a2d0c..4e211d93 100644 --- a/tests/generating_email.rs +++ b/tests/generating_email.rs @@ -1,20 +1,11 @@ use melib; use melib::email::Draft; -use xdg_utils::query_mime_info; #[test] fn build_draft() { let mut new_draft = Draft::default(); - let mut attachment = melib::email::attachment_from_file(&"./tests/test_image.gif") + let attachment = melib::email::attachment_from_file(&"./tests/test_image.gif") .expect("Could not open test_image.gif."); - if let Ok(mime_type) = query_mime_info("./tests/test_image.gif") { - match attachment.content_type { - melib::email::attachment_types::ContentType::Other { ref mut tag, .. } => { - *tag = mime_type; - } - _ => {} - } - } new_draft.headers_mut().remove("User-Agent"); new_draft.headers_mut().remove("Date"); @@ -27,5 +18,5 @@ fn build_draft() { let boundary_str = &boundary["bzz_bzz__bzz__".len()..]; let raw = raw.replace(boundary_str, ""); - assert_eq!(include_str!("generated.mail"), &raw); + assert_eq!(include_str!("generated_email.eml"), &raw); } |