Add test for registerAdminArnsHandlers (#2053)
This commit is contained in:
committed by
GitHub
parent
c9d174df09
commit
68e98be376
@@ -19,9 +19,13 @@ package restapi
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/go-openapi/loads"
|
||||
"github.com/minio/console/restapi/operations"
|
||||
"github.com/minio/madmin-go"
|
||||
|
||||
asrt "github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -52,3 +56,19 @@ func TestArnsList(t *testing.T) {
|
||||
assert.Nil(arnsList, "arn list was not returned nil")
|
||||
assert.NotNil(err, "An error should have been returned")
|
||||
}
|
||||
|
||||
func TestRegisterAdminArnsHandlers(t *testing.T) {
|
||||
assert := asrt.New(t)
|
||||
swaggerSpec, err := loads.Embedded(SwaggerJSON, FlatSwaggerJSON)
|
||||
if err != nil {
|
||||
assert.Fail("Error")
|
||||
}
|
||||
api := operations.NewConsoleAPI(swaggerSpec)
|
||||
api.SystemArnListHandler = nil
|
||||
registerAdminArnsHandlers(api)
|
||||
if api.SystemArnListHandler == nil {
|
||||
assert.Fail("Assignment should happen")
|
||||
} else {
|
||||
fmt.Println("Function got assigned: ", api.SystemArnListHandler)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user