You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/01/28 05:59:31 UTC
[GitHub] [apisix-dashboard] starsz commented on a change in pull request #1384: fix: When exporting route, whether the parameter is empty or not
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:
users@infra.apache.org