diff options
| -rw-r--r-- | config_test.go | 29 | ||||
| -rw-r--r-- | go.mod | 2 |
2 files changed, 6 insertions, 25 deletions
diff --git a/config_test.go b/config_test.go index a303719..0ab881a 100644 --- a/config_test.go +++ b/config_test.go @@ -1,36 +1,17 @@ package main import ( - "strings" + "bytes" + _ "embed" "testing" "github.com/stretchr/testify/assert" ) -const cfg string = ` -message: - from: foo@example.com - to: bar@example.com - subject: New SMS From {{.From}} For {{.To}} - template: | - From: {{.From}} - To: {{.To}} - Date: {{.DateReceived.UTC}} - - {{.Message}} - -smtp: - hostname: example.com:465 - username: bar - password: some password - -twilio: - address: /run/fwdsms/socket - authToken: some token - endpoint: / -` +//go:embed config_example.yaml +var cfg []byte func TestConfig(t *testing.T) { - _, err := loadConfig(strings.NewReader(cfg)) + _, err := loadConfig(bytes.NewReader(cfg)) assert.NoError(t, err) } @@ -1,6 +1,6 @@ module go.awhk.org/fwdsms -go 1.15 +go 1.16 require ( github.com/gorilla/handlers v1.5.1 |
