starsz commented on a change in pull request #1384:
URL: https://github.com/apache/apisix-dashboard/pull/1384#discussion_r565838573
##########
File path: api/internal/handler/data_loader/route_export_test.go
##########
@@ -1903,10 +1904,66 @@ func TestExportRoutesSameURI(t *testing.T) {
assert.True(t, getCalled)
}
+func TestExportRoutesParameterEmpty(t *testing.T) {
+ // Error test when pass parameter is null
+ r1 := `{
+ "uris": ["/test-test"],
+ "name": "route_all",
+ "desc": "所有",
+ "methods": ["GET"],
+ "hosts": ["test.com"],
+ "status": 1,
+ "upstream": {
+ "nodes": {
+ "172.16.238.20:1980": 1
+ },
+ "type": "roundrobin"
+ }
+}`
+ var route *entity.Route
+ err := json.Unmarshal([]byte(r1), &route)
+ assert.Nil(t, err)
+ mStore := &store.MockInterface{}
+ mStore.On("Get", mock.Anything).Run(func(args mock.Arguments) {
+ }).Return(route, nil)
Review comment:
IMO, mStore.Get will never be called if the input.IDs is "".
So we can remove the mock here.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]