Skip to content

Commit

Permalink
test: add unit tests for module to test when resource group is empty …
Browse files Browse the repository at this point in the history
…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.
53 changes: 53 additions & 0 deletions modules/azure/actiongroup_test.go
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)
}

0 comments on commit ead0c8f

Please sign in to comment.