(t *testing.T)
| 905 | } |
| 906 | |
| 907 | func TestRevocationWithAdminRoles(t *testing.T) { |
| 908 | defer db.SuspendSequenceBatching()() |
| 909 | |
| 910 | rt := NewRestTester(t, &RestTesterConfig{SyncFn: channels.DocChannelsSyncFunction}) |
| 911 | defer rt.Close() |
| 912 | |
| 913 | resp := rt.SendAdminRequest("PUT", "/db/_role/role", GetRolePayload(t, "", rt.GetSingleDataStore(), []string{"A"})) |
| 914 | RequireStatus(t, resp, http.StatusCreated) |
| 915 | |
| 916 | resp = rt.SendAdminRequest("PUT", "/db/_user/user", `{"admin_roles": ["role"], "password": "letmein"}`) |
| 917 | RequireStatus(t, resp, http.StatusCreated) |
| 918 | |
| 919 | resp = rt.SendAdminRequest("PUT", "/{{.keyspace}}/doc", `{"channels": ["A"]}`) |
| 920 | RequireStatus(t, resp, http.StatusCreated) |
| 921 | |
| 922 | changes := rt.WaitForChanges(2, "/{{.keyspace}}/_changes?since=0&revocations=true", "user", false) |
| 923 | |
| 924 | assert.Equal(t, "doc", changes.Results[1].ID) |
| 925 | assert.False(t, changes.Results[1].Revoked) |
| 926 | |
| 927 | resp = rt.SendAdminRequest("PUT", "/db/_user/user", `{"admin_roles": []}`) |
| 928 | RequireStatus(t, resp, http.StatusOK) |
| 929 | |
| 930 | changes = rt.WaitForChanges(2, fmt.Sprintf("/{{.keyspace}}/_changes?since=%d&revocations=true", 3), "user", false) |
| 931 | |
| 932 | assert.Equal(t, "doc", changes.Results[0].ID) |
| 933 | assert.True(t, changes.Results[0].Revoked) |
| 934 | } |
| 935 | |
| 936 | func TestRevocationMutationMovesIntoRevokedChannel(t *testing.T) { |
| 937 | defer db.SuspendSequenceBatching()() |
nothing calls this directly
no test coverage detected