Skip to content

Commit

Permalink
Added test for env in out request
Browse files Browse the repository at this point in the history
Signed-off-by: Vlad Kirichenko <[email protected]>
  • Loading branch information
Vlad-Kirichenko committed Sep 29, 2021
1 parent dc4ff71 commit f114fcd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkg/models/out_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,17 @@ func TestGetConfigMapStructuredConfig(t *testing.T) {
assert.NotEmpty(t, request.Params)
assert.Equal(t, expected, request.GetConfigMap())
}
func TestDecodeOutRequestWithEnvList(t *testing.T) {
jsonRequest := []byte("{ \"source\": " + source + ", \"params\": { \"env\": { \"VARIABLE_1\": \"value1\" , \"VARIABLE_2\": \"value2\"}}}")
request := OutRequest{}
if err := json.Unmarshal(jsonRequest, &request); err != nil {
assert.Fail(t, "Failed to unmarshal to OutRequest: %s", err)
}

expected := map[string]string{"VARIABLE_1": "value1", "VARIABLE_2": "value2"}

assert.NotNil(t, request)
assert.NotNil(t, request.Params)
assert.NotEmpty(t, request.Params)
assert.Equal(t, expected, request.Params.Env)
}

0 comments on commit f114fcd

Please sign in to comment.