MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestSerializeRole

Function TestSerializeRole

auth/auth_test.go:178–194  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

176}
177
178func TestSerializeRole(t *testing.T) {
179
180 ctx := base.TestCtx(t)
181 bucket := base.GetTestBucket(t)
182 defer bucket.Close(ctx)
183 dataStore := bucket.GetSingleDataStore()
184 auth := NewTestAuthenticator(t, dataStore, nil, DefaultAuthenticatorOptions(ctx))
185 role, _ := auth.NewRole("froods", ch.BaseSetOf(t, "hoopy", "public"))
186 encoded := base.MustJSONMarshal(t, role)
187 require.NotNil(t, encoded)
188 log.Printf("Marshaled Role as: %s", encoded)
189 elor := &roleImpl{}
190 require.NoError(t, base.JSONUnmarshal(encoded, elor))
191
192 assert.Equal(t, role.Name(), elor.Name())
193 assert.Equal(t, role.ExplicitChannels(), elor.ExplicitChannels())
194}
195
196func TestUserAccess(t *testing.T) {
197

Callers

nothing calls this directly

Calls 14

NameMethod · 0.95
ExplicitChannelsMethod · 0.95
TestCtxFunction · 0.92
GetTestBucketFunction · 0.92
MustJSONMarshalFunction · 0.92
JSONUnmarshalFunction · 0.92
NewTestAuthenticatorFunction · 0.85
NewRoleMethod · 0.80
CloseMethod · 0.65
NameMethod · 0.65
ExplicitChannelsMethod · 0.65

Tested by

no test coverage detected