Skip to content

Commit

Permalink
add new case about #870
Browse files Browse the repository at this point in the history
  • Loading branch information
idbeta committed Nov 25, 2020
1 parent dc8187f commit 0032669
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion api/test/e2e/consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ func TestConsumer_create_consumer_with_createtime_updatetime(t *testing.T) {
createtime := gjson.Get(string(respBody), "data.create_time")
updatetime := gjson.Get(string(respBody), "data.update_time")

//create consumer again, compair the new result and the result_A
//create consumer again, compare the new result and the result_A
data = `{
"username":"case_8",
"desc": "new consumer haha"
Expand Down Expand Up @@ -462,6 +462,46 @@ func TestConsumer_create_consumer_with_invalid_format_of_label(t *testing.T) {
}
}

//case11: create consumers with two auth plugin
func TestConsumer_create_consumer_with_two_authplugin(t *testing.T) {
tests := []HttpTestCase{
{
caseDesc: "create consumers with two auth plugin",
Object: MangerApiExpect(t),
Path: "/apisix/admin/consumers",
Method: http.MethodPut,
Body: `{
"username": "case_11",
"plugins": {
"jwt-auth": {
"key": "a36c3049b36249a3c9f8891cb127243c",
"secret": "e71829c351aa4242c2719cbfbe671c09"
},
"key-auth": {
"key": "auth-one"
}
}
}`,
Headers: map[string]string{"Authorization": token},
ExpectStatus: http.StatusBadRequest,
ExpectBody: "only one auth plugin is allowed",
},
{
caseDesc: "verify consumer",
Object: MangerApiExpect(t),
Path: "/apisix/admin/consumers/case_11",
Method: http.MethodGet,
Headers: map[string]string{"Authorization": token},
ExpectStatus: http.StatusNotFound,
Sleep: sleepTime, //sleep x millisecond before verify route
},
}

for _, tc := range tests {
testCaseCheck(tc)
}
}

//Teardown
func TestConsumer_teardown(t *testing.T) {
_ = []HttpTestCase{
Expand Down

0 comments on commit 0032669

Please sign in to comment.