-
Notifications
You must be signed in to change notification settings - Fork 104
/
bucket_internal_test.go
39 lines (30 loc) · 1.22 KB
/
bucket_internal_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package gocb
import "github.com/couchbase/gocbcore/v10"
func (suite *UnitTestSuite) TestCollectionInternal_BucketCapabilityStatus_Supported() {
provider := new(mockKvCapabilityVerifier)
provider.On(
"BucketCapabilityStatus",
gocbcore.BucketCapabilityDurableWrites,
).Return(gocbcore.CapabilityStatusSupported)
cli := new(mockConnectionManager)
cli.On("getKvCapabilitiesProvider", "mock").Return(provider, nil)
b := suite.bucket("mock", suite.defaultTimeoutConfig(), cli)
ib := b.Internal()
status, err := ib.CapabilityStatus(CapabilityDurableWrites)
suite.Require().Nil(err)
suite.Assert().Equal(CapabilityStatusSupported, status)
}
func (suite *UnitTestSuite) TestCollectionInternal_BucketCapabilityStatus_Unsupported() {
provider := new(mockKvCapabilityVerifier)
provider.On(
"BucketCapabilityStatus",
gocbcore.BucketCapabilityDurableWrites,
).Return(gocbcore.CapabilityStatusUnsupported)
cli := new(mockConnectionManager)
cli.On("getKvCapabilitiesProvider", "mock").Return(provider, nil)
b := suite.bucket("mock", suite.defaultTimeoutConfig(), cli)
ib := b.Internal()
status, err := ib.CapabilityStatus(CapabilityDurableWrites)
suite.Require().Nil(err)
suite.Assert().Equal(CapabilityStatusUnsupported, status)
}