2021-06-04 11:22:52 +00:00
|
|
|
package admin
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2021-07-27 16:21:53 +00:00
|
|
|
"net/http"
|
2021-06-04 11:22:52 +00:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (suite *RadosGWTestSuite) TestQuota() {
|
|
|
|
suite.SetupConnection()
|
2021-07-27 16:21:53 +00:00
|
|
|
co, err := New(suite.endpoint, suite.accessKey, suite.secretKey, newDebugHTTPClient(http.DefaultClient))
|
2021-06-04 11:22:52 +00:00
|
|
|
assert.NoError(suite.T(), err)
|
|
|
|
|
|
|
|
suite.T().Run("set quota to user but user ID is empty", func(t *testing.T) {
|
|
|
|
err := co.SetUserQuota(context.Background(), QuotaSpec{})
|
|
|
|
assert.Error(suite.T(), err)
|
|
|
|
assert.EqualError(suite.T(), err, errMissingUserID.Error())
|
|
|
|
})
|
|
|
|
|
|
|
|
suite.T().Run("get user quota but no user is specified", func(t *testing.T) {
|
|
|
|
_, err := co.GetUserQuota(context.Background(), QuotaSpec{})
|
|
|
|
assert.Error(suite.T(), err)
|
|
|
|
assert.EqualError(suite.T(), err, errMissingUserID.Error())
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|