From 2b2566b801ffec1a7950e91c8e3c12d2e0b55183 Mon Sep 17 00:00:00 2001 From: Florian Hoss Date: Wed, 21 Jun 2023 17:25:59 +0200 Subject: [PATCH] Update env_test.go --- internal/env/env_test.go | 44 ---------------------------------------- 1 file changed, 44 deletions(-) diff --git a/internal/env/env_test.go b/internal/env/env_test.go index 7f8584c..4499588 100644 --- a/internal/env/env_test.go +++ b/internal/env/env_test.go @@ -54,47 +54,3 @@ func TestTimeZoneParser(t *testing.T) { _, err = Parse() assert.Equal(t, err.Error(), "Key: 'Config.TimeZone' Error:Field validation for 'TimeZone' failed on the 'timezone' tag", "Validation should fail") } - -func TestHealthcheckUrlParser(t *testing.T) { - key := "HEALTHCHECK_URL" - var err error - defer func() { - os.Unsetenv(key) - }() - - os.Setenv(key, "https://example.com/") - _, err = Parse() - assert.Equal(t, err, nil, "Parsing should pass") - - os.Setenv(key, "http://www.example.com/") - _, err = Parse() - assert.Equal(t, err, nil, "Parsing should pass") - - os.Setenv(key, "https://example.com") - _, err = Parse() - assert.Equal(t, err.Error(), "Key: 'Config.HealthcheckURL' Error:Field validation for 'HealthcheckURL' failed on the 'endswith' tag", "Validation should fail") - - os.Setenv(key, "abc") - _, err = Parse() - assert.Equal(t, err.Error(), "Key: 'Config.HealthcheckURL' Error:Field validation for 'HealthcheckURL' failed on the 'url' tag", "Validation should fail") -} - -func TestShoutrrrParser(t *testing.T) { - key := "NOTIFICATION_URL" - var err error - defer func() { - os.Unsetenv(key) - }() - - os.Setenv(key, "smtp://xxx@xxx.com:xxx@smtp.gmail.com:587/?from=xxx@xxx.com&to=xxx@xxx.com") - _, err = Parse() - assert.Equal(t, err, nil, "Parsing should pass") - - os.Setenv(key, "https://example.com") - _, err = Parse() - assert.Equal(t, err.Error(), "Key: 'Config.NotificationURL' Error:Field validation for 'NotificationURL' failed on the 'shoutrrr' tag", "Validation should fail") - - os.Setenv(key, "abc") - _, err = Parse() - assert.Equal(t, err.Error(), "Key: 'Config.NotificationURL' Error:Field validation for 'NotificationURL' failed on the 'shoutrrr' tag", "Validation should fail") -}