diff options
author | zeripath <art27@cantab.net> | 2021-12-10 19:43:28 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-10 19:43:28 +0000 |
commit | f550e356d6cfe84b2891776d778531afa92ef902 (patch) | |
tree | 2daf491cd4bdc7eeca333b685a335e92a7bf34eb /services/mailer | |
parent | 3ca5dc7e32b372d14ff80d96f14b8f6a805862f1 (diff) | |
download | gitea-f550e356d6cfe84b2891776d778531afa92ef902.tar.gz gitea-f550e356d6cfe84b2891776d778531afa92ef902.zip |
Prevent services/mailer/mailer_test.go tests from deleteing data directory (#17941)
Running `make test-backend` will delete `data/` due to reloading the configuration and resetting the appdatapath.
This PR removes this unnecessary config reload but also adds extra code in to the unittest main to prevent its cleanup from deleting the wrong directory.
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'services/mailer')
-rw-r--r-- | services/mailer/mailer_test.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/services/mailer/mailer_test.go b/services/mailer/mailer_test.go index 8505803d22..1739a68a64 100644 --- a/services/mailer/mailer_test.go +++ b/services/mailer/mailer_test.go @@ -9,17 +9,16 @@ import ( "time" "code.gitea.io/gitea/modules/setting" - "github.com/stretchr/testify/assert" ) func TestGenerateMessageID(t *testing.T) { - setting.LoadForTest(` -[mailer] -ENABLED = true -FROM = test@domain.com -`) - setting.NewServices() + var mailService = setting.Mailer{ + From: "test@gitea.com", + } + + setting.MailService = &mailService + setting.Domain = "localhost" date := time.Date(2000, 01, 02, 03, 04, 05, 06, time.UTC) m := NewMessageFrom(nil, "display-name", "from-address", "subject", "body") |