| 1 | package testutilsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/ |
| 2 | |
| 3 | import ( |
| 4 | "net/urlscip-go gomod github.com/golang/go/src . `net/url`/" |
| 5 | |
| 6 | "github.com/onsi/gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/" |
| 7 | |
| 8 | "github.com/nicholas-fedor/shoutrrr/pkg/formatscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/format`/" |
| 9 | "github.com/nicholas-fedor/shoutrrr/pkg/typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/" |
| 10 | ) |
| 11 | |
| 12 | // TestConfigGetInvalidQueryValue tests whether the config returns |
| 13 | // an error when an invalid query value is requested. |
| 14 | func TestConfigGetInvalidQueryValuescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/TestConfigGetInvalidQueryValue().(config typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/.ServiceConfigscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/ServiceConfig#) { |
| 15 | value, err := formatscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/format`/.GetConfigQueryResolverscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/format`/GetConfigQueryResolver().(config).Getscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/ConfigQueryResolver#Get.("invalid query var") |
| 16 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.ExpectWithOffsetscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/ExpectWithOffset().(1, value).Toscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#To().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.BeEmptyscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/BeEmpty().()) |
| 17 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.ExpectWithOffsetscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/ExpectWithOffset().(1, err).Toscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#To().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 18 | } |
| 19 | |
| 20 | // TestConfigSetInvalidQueryValue tests whether the config returns |
| 21 | // an error when a URL with an invalid query value is parsed. |
| 22 | func TestConfigSetInvalidQueryValuescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/TestConfigSetInvalidQueryValue().(config typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/.ServiceConfigscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/ServiceConfig#, rawInvalidURL string) { |
| 23 | invalidURL, err := urlscip-go gomod github.com/golang/go/src . `net/url`/.Parsescip-go gomod github.com/golang/go/src . `net/url`/Parse().(rawInvalidURL) |
| 24 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.ExpectWithOffsetscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/ExpectWithOffset().(1, err). |
| 25 | ToNotscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#ToNot().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().(), "the test URL did not parse correctly") |
| 26 | |
| 27 | err = config.SetURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/ServiceConfig#SetURL.(invalidURL) |
| 28 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.ExpectWithOffsetscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/ExpectWithOffset().(1, err).Toscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#To().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 29 | } |
| 30 | |
| 31 | // TestConfigSetDefaultValues tests whether setting the default values |
| 32 | // can be set for an empty config without any errors. |
| 33 | func TestConfigSetDefaultValuesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/TestConfigSetDefaultValues().(config typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/.ServiceConfigscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/ServiceConfig#) { |
| 34 | pkr := formatscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/format`/.NewPropKeyResolverscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/format`/NewPropKeyResolver().(config) |
| 35 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.ExpectWithOffsetscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/ExpectWithOffset().(1, pkr.SetDefaultPropsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/format`/PropKeyResolver#SetDefaultProps().(config)).Toscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#To().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Succeedscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Succeed().()) |
| 36 | } |
| 37 | |
| 38 | // TestConfigGetEnumsCount tests whether the config.Enums returns the expected amount of items. |
| 39 | func TestConfigGetEnumsCountscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/TestConfigGetEnumsCount().(config typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/.ServiceConfigscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/ServiceConfig#, expectedCount int) { |
| 40 | enums := config.Enumsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Enummer#Enums.() |
| 41 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.ExpectWithOffsetscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/ExpectWithOffset().(1, enums).Toscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#To().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveLenscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveLen().(expectedCount)) |
| 42 | } |
| 43 | |
| 44 | // TestConfigGetFieldsCount tests whether the config.QueryFields return the expected amount of fields. |
| 45 | func TestConfigGetFieldsCountscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/TestConfigGetFieldsCount().(config typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/.ServiceConfigscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/ServiceConfig#, expectedCount int) { |
| 46 | fields := formatscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/format`/.GetConfigQueryResolverscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/format`/GetConfigQueryResolver().(config).QueryFieldsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/ConfigQueryResolver#QueryFields.() |
| 47 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.ExpectWithOffsetscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/ExpectWithOffset().(1, fields).Toscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#To().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveLenscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveLen().(expectedCount)) |
| 48 | } |