Commit graph

20 commits

Author SHA1 Message Date
fe765cd49e
Add filename sanitization tests for attachments
Introduced tests to validate filename sanitization for attachments, ensuring disallowed characters are handled correctly. These tests cover various scenarios, including different character sets such as Japanese, Chinese, and Cyrillic.
2024-11-26 16:17:34 +01:00
b051471f8d
Add tests for the sanitizeFilename function
This commit introduces a series of tests for the sanitizeFilename function in msgwriter_test.go. The tests cover various edge cases to ensure filenames are sanitized correctly by replacing or removing invalid characters. These additions will help maintain the integrity and reliability of filename sanitization in the codebase.
2024-11-26 12:02:15 +01:00
29794fd6ad
Fix typo in Content-Disposition header in tests
Corrected multiple instances of the misspelled "Content-Dispositon" to "Content-Disposition" in the msgwriter_test.go file. This ensures that the error messages in the tests are accurate and improve code readability.
2024-11-11 20:08:58 +01:00
c9f8a2acdd
Fix newline character in test attachment string for Windows
Updated the base64-encoded string for attachments in the tests to reflect the correct newline character for Windows. This ensures that the test cases correctly validate the presence of attachments in the mail messages.
2024-10-28 22:28:23 +01:00
b63a3dab9a
Adjust tests to handle platform-specific differences.
Added platform-specific checks for header and attachment content in `msgwriter_test.go`. This ensures compatibility and correct behavior on different operating systems, such as Windows and FreeBSD.
2024-10-28 22:20:09 +01:00
a30215ebce
Add tests for writeHeader and writeBody functions
Introduce comprehensive test cases for the writeHeader and writeBody functions in msgWriter. These tests cover various scenarios including handling of multiple header values, edge cases, and error conditions in body writing operations. This concludes all tests for msgwriter.go.
2024-10-28 22:02:43 +01:00
b7a87fb15b
Add tests for MsgWriter_writeString function
Implemented tests to validate the MsgWriter writeString method for successful writes, failure scenarios, and handling pre-existing errors in the writer. This improves coverage and ensures robustness of the MsgWriter component.
2024-10-28 21:30:50 +01:00
dedb0e36c8
Add tests for MsgWriter writePart functionality
Introduce tests to validate MsgWriter's handling of message parts. This includes ensuring charset defaulting behavior and proper inclusion of part descriptions.
2024-10-28 21:25:22 +01:00
5c8d07407f
Add tests for file attachments in msgWriter
This commit introduces unit tests covering various scenarios for attaching files in email messages using msgWriter. These tests check for proper encoding, custom content types, different transfer encodings, custom descriptions, and handling attachments without body parts.
2024-10-28 21:13:36 +01:00
61244a541e
Refactor msgWriter tests and add new test cases
Reorganize existing tests for msgWriter and writeMsg, adding subtests for various encoding, charset, and failure scenarios. Enhanced tests to cover multipart/mixed, multipart/related, multipart/alternative, application/pgp-encrypted, application/pgp-signature messages, and handling of preformatted headers.
2024-10-28 20:52:38 +01:00
590dfe97e7
Refactor error handling for nil template pointers
Replace fmt.Errorf with errors.New for consistency in error handling. This change ensures a more streamlined and uniform error reporting approach across the codebase. Also updated a test case from t.Errorf to t.Error for better readability.
2024-08-16 10:16:53 +02:00
263f6bb3de
Refactor SMTP client code for better readability
The variable names in the code related to the I/O of the SMTP client have been clarified for improved readability and comprehension. For example, unclear variable names like `d` and `w` have been replaced with more meaningful names like `depth` and `writer`. The same naming improvements have also been applied to function parameters. This update aims to enhance code maintenance and simplify future development processes.
2024-02-24 12:43:01 +01:00
2f60d9c5df
Add support for HTML alternative message body
The code has been updated to allow for an HTML alternative to the plain text body in messages. This includes adding a new function to add this alternative body along with additional unit tests to ensure the multipart messages are properly constructed. The tests also check the correct usage of different charsets.
2024-02-05 11:46:06 +01:00
900280a6cd
Test coverage for the added functionalities 2023-02-13 11:09:19 +01:00
3922d3f195
Switched copyright header from me to "The go-mail Authors" 2023-01-15 16:14:19 +01:00
31001e87b2
#24: Add SPDX license IDs for REUSE compliance
# SUMMARY

* Bad licenses:
* Deprecated licenses:
* Licenses without file extension:
* Missing licenses:
* Unused licenses:
* Used licenses: CC0-1.0, MIT
* Read errors: 0
* Files with copyright information: 45 / 45
* Files with license information: 45 / 45

Congratulations! Your project is compliant with version 3.0 of the REUSE Specification :-)
2022-06-17 15:05:54 +02:00
894ff7128c
Rename Write() to WriteTo() so it satisfies the io.WriteTo interface 2022-05-24 15:46:59 +02:00
975ebfc4b7
Make GoLinter happy 2022-03-21 14:55:49 +01:00
c3298d7181
Make GoLinter happy 2022-03-21 10:17:26 +01:00
830cb5632d
msgwriter.go is now fully test covered (93%) 2022-03-21 09:55:45 +01:00