summaryrefslogtreecommitdiffstats
path: root/src/k8splugin/api/defhandler_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/k8splugin/api/defhandler_test.go')
-rw-r--r--src/k8splugin/api/defhandler_test.go25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/k8splugin/api/defhandler_test.go b/src/k8splugin/api/defhandler_test.go
index fd17f50e..e638ca05 100644
--- a/src/k8splugin/api/defhandler_test.go
+++ b/src/k8splugin/api/defhandler_test.go
@@ -90,13 +90,15 @@ func TestRBDefCreateHandler(t *testing.T) {
label: "Create without UUID",
expectedCode: http.StatusCreated,
reader: bytes.NewBuffer([]byte(`{
- "name":"testdomain",
+ "name":"testresourcebundle",
+ "chart-name":"testchart",
"description":"test description",
"service-type":"firewall"
}`)),
expected: rb.Definition{
UUID: "123e4567-e89b-12d3-a456-426655440000",
Name: "testresourcebundle",
+ ChartName: "testchart",
Description: "test description",
ServiceType: "firewall",
},
@@ -106,12 +108,33 @@ func TestRBDefCreateHandler(t *testing.T) {
{
UUID: "123e4567-e89b-12d3-a456-426655440000",
Name: "testresourcebundle",
+ ChartName: "testchart",
Description: "test description",
ServiceType: "firewall",
},
},
},
},
+ {
+ label: "Missing Name in Request Body",
+ reader: bytes.NewBuffer([]byte(`{
+ "chart-name":"testchart",
+ "description":"test description",
+ "service-type":"firewall"
+ }`)),
+ expectedCode: http.StatusBadRequest,
+ rbDefClient: &mockRBDefinition{},
+ },
+ {
+ label: "Missing Chart Name in Request Body",
+ reader: bytes.NewBuffer([]byte(`{
+ "name":"testresourcebundle",
+ "description":"test description",
+ "service-type":"firewall"
+ }`)),
+ expectedCode: http.StatusBadRequest,
+ rbDefClient: &mockRBDefinition{},
+ },
}
for _, testCase := range testCases {