-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add unit tests for module to test when resource group is empty …
…or invalid.
- Loading branch information
James Jackson
committed
Sep 22, 2020
1 parent
b678f26
commit ead0c8f
Showing
1 changed file
with
53 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// +build azure | ||
|
||
// NOTE: We use build tags to differentiate azure testing because we currently do not have azure access setup for | ||
// CircleCI. | ||
|
||
package azure | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
/* | ||
The below tests are currently stubbed out, with the expectation that they will throw errors. | ||
If/when methods to create and delete network resources are added, these tests can be extended. | ||
*/ | ||
|
||
func TestGetActionGroupResourceEWithMissingResourceGroupName(t *testing.T) { | ||
t.Parallel() | ||
|
||
ruleName := "Hello" | ||
resGroupName := "" | ||
subscriptionID := "" | ||
|
||
_, err := GetActionGroupResourceE(ruleName, resGroupName, subscriptionID) | ||
|
||
require.Error(t, err) | ||
} | ||
|
||
func TestGetActionGroupResourceEWithInvalidResourceGroupName(t *testing.T) { | ||
t.Parallel() | ||
|
||
ruleName := "" | ||
resGroupName := "Hello" | ||
subscriptionID := "" | ||
|
||
_, err := GetActionGroupResourceE(ruleName, resGroupName, subscriptionID) | ||
|
||
require.Error(t, err) | ||
} | ||
|
||
func TestGetActionGroupClient(t *testing.T) { | ||
t.Parallel() | ||
|
||
subscriptionID := "" | ||
|
||
client, err := getActionGroupClient(subscriptionID) | ||
|
||
require.NoError(t, err) | ||
assert.NotEmpty(t, *client) | ||
} |