Skip to content

Commit

Permalink
Improve testcases
Browse files Browse the repository at this point in the history
Signed-off-by: imjoey <majunjiev@gmail.com>
  • Loading branch information
imjoey committed Jan 14, 2021
1 parent 89ef49b commit 20ad7df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion api/internal/handler/route/route_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,8 @@ func Test_Route_With_Script_Luacode(t *testing.T) {
err = json.Unmarshal([]byte(reqBody), route)
assert.Nil(t, err)
ctx.SetInput(route)
_, err = handler.Create(ctx)
ret, err = handler.Create(ctx)
assert.NotNil(t, err)
assert.EqualError(t, err, "<string> at EOF: syntax error\n")
assert.Equal(t, http.StatusBadRequest, ret.(*data.SpecCodeResponse).StatusCode)
}
9 changes: 9 additions & 0 deletions api/test/e2e/route_with_script_luacode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ func TestRoute_with_script_lucacode(t *testing.T) {
ExpectBody: "hit access phase",
Sleep: sleepTime,
},
{
Desc: "hit the route in APISIX",
Object: APISIXExpect(t),
Method: http.MethodGet,
Path: "/hello",
Headers: map[string]string{"Authorization": token},
ExpectStatus: http.StatusOK,
ExpectBody: "hit access phase",
},
{
Desc: "update route with script of valid lua code",
Object: ManagerApiExpect(t),
Expand Down

0 comments on commit 20ad7df

Please sign in to comment.