-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated seralisation and testing for deployment action containers
- Loading branch information
Showing
2 changed files
with
56 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package octopusdeploy | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/OctopusDeploy/go-octopusdeploy/octopusdeploy" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestExpandDeploymentActionContainer(t *testing.T) { | ||
expected := octopusdeploy.DeploymentActionContainer{} | ||
actual := expandDeploymentActionContainer(nil) | ||
require.Equal(t, expected, actual) | ||
|
||
var emptyInterface interface{} | ||
actual = expandDeploymentActionContainer(emptyInterface) | ||
require.Equal(t, expected, actual) | ||
|
||
var emptyInterfaceArray []interface{} | ||
actual = expandDeploymentActionContainer(emptyInterfaceArray) | ||
require.Equal(t, expected, actual) | ||
|
||
var testMap []interface{} = make([]interface{}, 1) | ||
actual = expandDeploymentActionContainer(testMap) | ||
require.Equal(t, expected, actual) | ||
|
||
testMap[0] = make(map[string]interface{}, 1) | ||
actual = expandDeploymentActionContainer(testMap) | ||
require.Equal(t, expected, actual) | ||
|
||
testMap[0] = map[string]interface{}{ | ||
"feed_id": "feeds-123", | ||
"image": "image-123", | ||
} | ||
expected = octopusdeploy.DeploymentActionContainer{ | ||
FeedID: "feeds-123", | ||
Image: "image-123", | ||
} | ||
actual = expandDeploymentActionContainer(testMap) | ||
|
||
require.Equal(t, expected, actual) | ||
} |