Skip to content

Commit

Permalink
test: Tests with non-existent keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimedrolity committed Nov 11, 2022
1 parent c098339 commit d352db3
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions senders/mattermost/sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,19 @@ func TestInit(t *testing.T) {
Convey("Init tests", t, func() {
sender := &mattermost.Sender{}

Convey("No url", func() {
senderSettings := map[string]string{
"api_token": "qwerty",
"front_uri": "qwerty",
"insecure_tls": "true",
}
err := sender.Init(senderSettings, logger, nil, "")
So(err, ShouldNotBeNil)
})

Convey("Empty url", func() {
senderSettings := map[string]string{
"url": "",
"api_token": "qwerty",
"front_uri": "qwerty",
"insecure_tls": "true",
Expand All @@ -24,20 +35,33 @@ func TestInit(t *testing.T) {
So(err, ShouldNotBeNil)
})

Convey("Empty api_token", func() {
Convey("No api_token", func() {
senderSettings := map[string]string{"url": "qwerty", "front_uri": "qwerty"}
err := sender.Init(senderSettings, logger, nil, "")
So(err, ShouldNotBeNil)
})

Convey("Empty front_uri", func() {
Convey("Empty api_token", func() {
senderSettings := map[string]string{"url": "qwerty", "front_uri": "qwerty", "api_token": ""}
err := sender.Init(senderSettings, logger, nil, "")
So(err, ShouldNotBeNil)
})

Convey("No front_uri", func() {
senderSettings := map[string]string{"url": "qwerty", "api_token": "qwerty"}
err := sender.Init(senderSettings, logger, nil, "")
So(err, ShouldNotBeNil)
})

Convey("Empty front_uri", func() {
senderSettings := map[string]string{"url": "qwerty", "api_token": "qwerty", "front_uri": ""}
err := sender.Init(senderSettings, logger, nil, "")
So(err, ShouldNotBeNil)
})

Convey("Full config", func() {
senderSettings := map[string]string{"url": "qwerty",
senderSettings := map[string]string{
"url": "qwerty",
"api_token": "qwerty",
"front_uri": "qwerty",
"insecure_tls": "true",
Expand Down

0 comments on commit d352db3

Please sign in to comment.