(t *testing.T)
| 195 | } |
| 196 | |
| 197 | func TestRevocationScenario1(t *testing.T) { |
| 198 | defer db.SuspendSequenceBatching()() |
| 199 | |
| 200 | revocationTester, rt := InitScenario(t, nil) |
| 201 | defer rt.Close() |
| 202 | |
| 203 | resp := rt.SendAdminRequest("PUT", "/{{.keyspace}}/doc1", `{"channels": "ch1"}`) |
| 204 | RequireStatus(t, resp, http.StatusCreated) |
| 205 | |
| 206 | revocationTester.fillToSeq(4) |
| 207 | revocationTester.addRoleChannel("foo", "ch1") |
| 208 | |
| 209 | changes := revocationTester.getChanges(5, 0) |
| 210 | assert.Equal(t, "5", changes.Last_Seq.String()) |
| 211 | |
| 212 | revocationTester.fillToSeq(19) |
| 213 | revocationTester.addRole("user", "foo") |
| 214 | revocationTester.fillToSeq(25) |
| 215 | |
| 216 | changes = revocationTester.getChanges(5, 1) |
| 217 | assert.Equal(t, "20:3", changes.Last_Seq.String()) |
| 218 | |
| 219 | revocationTester.fillToSeq(40) |
| 220 | |
| 221 | changes = revocationTester.getChanges(25, 0) |
| 222 | assert.Equal(t, "25", changes.Last_Seq.String()) |
| 223 | |
| 224 | revocationTester.fillToSeq(44) |
| 225 | revocationTester.removeRole("user", "foo") |
| 226 | revocationTester.fillToSeq(54) |
| 227 | revocationTester.removeRoleChannel("foo", "ch1") |
| 228 | revocationTester.fillToSeq(64) |
| 229 | revocationTester.addRole("user", "foo") |
| 230 | revocationTester.fillToSeq(74) |
| 231 | revocationTester.addRoleChannel("foo", "ch1") |
| 232 | revocationTester.fillToSeq(80) |
| 233 | |
| 234 | changes = revocationTester.getChanges(40, 1) |
| 235 | assert.Equal(t, "75:3", changes.Last_Seq.String()) |
| 236 | |
| 237 | revocationTester.fillToSeq(84) |
| 238 | revocationTester.removeRoleChannel("foo", "ch1") |
| 239 | revocationTester.fillToSeq(94) |
| 240 | revocationTester.removeRole("user", "foo") |
| 241 | revocationTester.fillToSeq(110) |
| 242 | |
| 243 | changes = revocationTester.getChanges(80, 1) |
| 244 | assert.Equal(t, "85:3", changes.Last_Seq.String()) |
| 245 | assert.True(t, changes.Results[0].Revoked) |
| 246 | } |
| 247 | |
| 248 | func TestRevocationScenario2(t *testing.T) { |
| 249 | defer db.SuspendSequenceBatching()() |
nothing calls this directly
no test coverage detected