From 425312034ffb4f206a213281347945a5e7d1df62 Mon Sep 17 00:00:00 2001 From: Adhityaa Date: Wed, 13 Jun 2018 00:32:32 +0530 Subject: [PATCH] smtp_configure_test.go: clean env before test Sometimes the tests end before they reach the end. --- api/smtp_configure_test.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/api/smtp_configure_test.go b/api/smtp_configure_test.go index 20a5c20..e0dee5a 100644 --- a/api/smtp_configure_test.go +++ b/api/smtp_configure_test.go @@ -13,6 +13,7 @@ func cleanSmtpVars() { func TestSmtpConfigureBasics(t *testing.T) { failTestOnError(t, setupTestEnv()) + cleanSmtpVars() os.Setenv("SMTP_USERNAME", "test@example.com") os.Setenv("SMTP_PASSWORD", "hunter2") @@ -23,12 +24,11 @@ func TestSmtpConfigureBasics(t *testing.T) { t.Errorf("unexpected error when configuring SMTP: %v", err) return } - - cleanSmtpVars() } func TestSmtpConfigureEmptyHost(t *testing.T) { failTestOnError(t, setupTestEnv()) + cleanSmtpVars() os.Setenv("SMTP_USERNAME", "test@example.com") os.Setenv("SMTP_PASSWORD", "hunter2") @@ -43,12 +43,11 @@ func TestSmtpConfigureEmptyHost(t *testing.T) { t.Errorf("SMTP configured when it should not be due to empty COMMENTO_SMTP_HOST") return } - - cleanSmtpVars() } func TestSmtpConfigureEmptyAddress(t *testing.T) { failTestOnError(t, setupTestEnv()) + cleanSmtpVars() os.Setenv("SMTP_USERNAME", "test@example.com") os.Setenv("SMTP_PASSWORD", "hunter2") @@ -59,6 +58,4 @@ func TestSmtpConfigureEmptyAddress(t *testing.T) { t.Errorf("expected error not found; SMTP should not be configured when COMMENTO_SMTP_FROM_ADDRESS is empty") return } - - cleanSmtpVars() }