Update tempfile path in unit tests

Changed tempfile creation path to "testdata/tmp" for better test organization and to ensure temporary files are stored within the testdata directory. This change affects the TestMsg_AttachFile_unixOnly tests.
This commit is contained in:
Winni Neessen 2024-10-27 18:02:37 +01:00
parent 7b9df7de47
commit 8fb05a33ff
Signed by: wneessen
GPG key ID: 385AC9889632126E
2 changed files with 2 additions and 2 deletions

View file

@ -18,7 +18,7 @@ import (
func TestMsg_AttachFile_unixOnly(t *testing.T) { func TestMsg_AttachFile_unixOnly(t *testing.T) {
t.Run("AttachFile with fileFromFS fails on open", func(t *testing.T) { t.Run("AttachFile with fileFromFS fails on open", func(t *testing.T) {
tempfile, err := os.CreateTemp("", "attachfile-unable-to-open.*.txt") tempfile, err := os.CreateTemp("testdata/tmp", "attachfile-unable-to-open.*.txt")
if err != nil { if err != nil {
t.Fatalf("failed to create temp file: %s", err) t.Fatalf("failed to create temp file: %s", err)
} }
@ -49,7 +49,7 @@ func TestMsg_AttachFile_unixOnly(t *testing.T) {
} }
}) })
t.Run("AttachFile with fileFromFS fails on copy", func(t *testing.T) { t.Run("AttachFile with fileFromFS fails on copy", func(t *testing.T) {
tempfile, err := os.CreateTemp("", "attachfile-close-early.*.txt") tempfile, err := os.CreateTemp("testdata/tmp", "attachfile-close-early.*.txt")
if err != nil { if err != nil {
t.Fatalf("failed to create temp file: %s", err) t.Fatalf("failed to create temp file: %s", err)
} }

0
testdata/tmp/.gitkeep vendored Normal file
View file