go-ceph/rgw/admin/quota_test.go
Sébastien Han 9cae71ab54 rgw/admin: remove Debug field from API type
Instead of implementing our own logging let's the consumer implement
their own potential debug for each HTTP requests.

Closes: https://github.com/ceph/go-ceph/issues/508
Signed-off-by: Sébastien Han <seb@redhat.com>
2021-07-27 18:21:53 +02:00

29 lines
787 B
Go

package admin
import (
"context"
"net/http"
"testing"
"github.com/stretchr/testify/assert"
)
func (suite *RadosGWTestSuite) TestQuota() {
suite.SetupConnection()
co, err := New(suite.endpoint, suite.accessKey, suite.secretKey, newDebugHTTPClient(http.DefaultClient))
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())
})
}