mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-21 13:20:49 +01:00
Prevent Test Execution Without Env Variable
Added a check for the "PERFORM_UNIX_OPEN_WRITE_TESTS" environment variable to conditionally skip tests. This ensures tests are only executed when the variable is set to "true". Additionally, commented out the TestMsg_WriteToTempFileFailed function.
This commit is contained in:
parent
1c6b9faf15
commit
c28bd7e331
1 changed files with 8 additions and 0 deletions
|
@ -94,6 +94,10 @@ func TestMsg_EmbedFile_unixOnly(t *testing.T) {
|
|||
|
||||
func TestMsg_WriteToFile_unixOnly(t *testing.T) {
|
||||
t.Run("WriteToFile fails on create", func(t *testing.T) {
|
||||
if os.Getenv("PERFORM_UNIX_OPEN_WRITE_TESTS") != "true" {
|
||||
t.Skipf("PERFORM_UNIX_OPEN_WRITE_TESTS variable is not set. Skipping unix open/write tests")
|
||||
}
|
||||
|
||||
tempfile, err := os.CreateTemp("", "testmail-create.*.eml")
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create temp file: %s", err)
|
||||
|
@ -116,6 +120,7 @@ func TestMsg_WriteToFile_unixOnly(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
/*
|
||||
func TestMsg_WriteToTempFileFailed(t *testing.T) {
|
||||
m := NewMsg()
|
||||
_ = m.From("Toni Tester <tester@example.com>")
|
||||
|
@ -137,3 +142,6 @@ func TestMsg_WriteToTempFileFailed(t *testing.T) {
|
|||
t.Errorf("WriteToTempFile() did not fail as expected")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue