mirror of
https://github.com/ceph/go-ceph
synced 2024-12-18 04:15:42 +00:00
9604e19a0e
Signed-off-by: Simon Jürgensmeyer <simon.juergensmeyer@hetzner-cloud.de>
24 lines
694 B
Go
24 lines
694 B
Go
package admin
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
var (
|
|
fakeGetUserError = []byte(`{"Code":"NoSuchUser","RequestId":"tx0000000000000000005a9-00608957a2-10496-my-store","HostId":"10496-my-store-my-store"}`)
|
|
fakeGetSubUserError = []byte(`{"Code":"NoSuchSubUser","RequestId":"tx0000000000000000005a9-00608957a2-10496-my-store","HostId":"10496-my-store-my-store"}`)
|
|
)
|
|
|
|
func TestHandleStatusError(t *testing.T) {
|
|
err := handleStatusError(fakeGetUserError)
|
|
assert.Error(t, err)
|
|
assert.True(t, errors.Is(err, ErrNoSuchUser), err)
|
|
|
|
err = handleStatusError(fakeGetSubUserError)
|
|
assert.Error(t, err)
|
|
assert.True(t, errors.Is(err, ErrNoSuchSubUser), err)
|
|
}
|