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

Function TestRevocationWithAdminChannels

rest/revocation_test.go:881–905  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

879}
880
881func TestRevocationWithAdminChannels(t *testing.T) {
882 defer db.SuspendSequenceBatching()()
883
884 rt := NewRestTester(t, &RestTesterConfig{SyncFn: channels.DocChannelsSyncFunction})
885 defer rt.Close()
886 dataStore := rt.GetSingleDataStore()
887
888 rt.CreateUser("user", []string{"A"})
889
890 resp := rt.SendAdminRequest("PUT", "/{{.keyspace}}/doc", `{"channels": ["A"]}`)
891 RequireStatus(t, resp, http.StatusCreated)
892
893 changes := rt.WaitForChanges(2, "/{{.keyspace}}/_changes?since=0&revocations=true", "user", false)
894
895 assert.Equal(t, "doc", changes.Results[1].ID)
896 assert.False(t, changes.Results[0].Revoked)
897
898 resp = rt.SendAdminRequest("PUT", "/db/_user/user", GetUserPayload(t, "", "letmein", "", dataStore, []string{}, nil))
899 RequireStatus(t, resp, http.StatusOK)
900
901 changes = rt.WaitForChanges(2, fmt.Sprintf("/{{.keyspace}}/_changes?since=%d&revocations=true", 2), "user", false)
902
903 assert.Equal(t, "doc", changes.Results[0].ID)
904 assert.True(t, changes.Results[0].Revoked)
905}
906
907func TestRevocationWithAdminRoles(t *testing.T) {
908 defer db.SuspendSequenceBatching()()

Callers

nothing calls this directly

Calls 10

CloseMethod · 0.95
GetSingleDataStoreMethod · 0.95
CreateUserMethod · 0.95
SendAdminRequestMethod · 0.95
WaitForChangesMethod · 0.95
SuspendSequenceBatchingFunction · 0.92
NewRestTesterFunction · 0.85
RequireStatusFunction · 0.85
GetUserPayloadFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected