-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Bring presetalert resources calls to new style
- Loading branch information
1 parent
4553236
commit dfb1590
Showing
11 changed files
with
345 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package logdna | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestRequestTypes_iterateIntegrationType(t *testing.T) { | ||
assert := assert.New(t) | ||
|
||
t.Run("Inserts a Diagnostics error for an unknown integration type", func(t *testing.T) { | ||
var diags diag.Diagnostics | ||
nonEmptyEntry := []interface{}{ | ||
map[string]interface{}{ | ||
"nah": "will not work", | ||
}, | ||
} | ||
|
||
channelRequests := iterateIntegrationType(nonEmptyEntry, "NOPE", &diags) | ||
|
||
assert.Empty(*channelRequests, "Nothing was returned") | ||
assert.Len(diags, 1, "There was 1 error") | ||
assert.True(diags.HasError(), "The message is of type `Error`") | ||
|
||
err := diags[0] | ||
assert.Equal("Cannot format integration channel for outbound request", err.Summary, "Summary") | ||
assert.Equal("Unrecognized integration: NOPE", err.Detail, "Detail") | ||
}) | ||
} |
Oops, something went wrong.