(t *testing.T)
| 350 | } |
| 351 | |
| 352 | func TestRevocationScenario4(t *testing.T) { |
| 353 | defer db.SuspendSequenceBatching()() |
| 354 | |
| 355 | revocationTester, rt := InitScenario(t, nil) |
| 356 | defer rt.Close() |
| 357 | |
| 358 | resp := rt.SendAdminRequest("PUT", "/{{.keyspace}}/doc1", `{"channels": "ch1"}`) |
| 359 | RequireStatus(t, resp, http.StatusCreated) |
| 360 | |
| 361 | revocationTester.fillToSeq(4) |
| 362 | revocationTester.addRoleChannel("foo", "ch1") |
| 363 | |
| 364 | changes := revocationTester.getChanges(5, 0) |
| 365 | assert.Equal(t, "5", changes.Last_Seq.String()) |
| 366 | |
| 367 | revocationTester.fillToSeq(19) |
| 368 | revocationTester.addRole("user", "foo") |
| 369 | revocationTester.fillToSeq(25) |
| 370 | |
| 371 | changes = revocationTester.getChanges(5, 1) |
| 372 | assert.Equal(t, "20:3", changes.Last_Seq.String()) |
| 373 | |
| 374 | revocationTester.fillToSeq(44) |
| 375 | revocationTester.removeRole("user", "foo") |
| 376 | revocationTester.fillToSeq(54) |
| 377 | revocationTester.removeRoleChannel("foo", "ch1") |
| 378 | revocationTester.fillToSeq(64) |
| 379 | revocationTester.addRole("user", "foo") |
| 380 | |
| 381 | revocationTester.fillToSeq(70) |
| 382 | changes = revocationTester.getChanges(25, 1) |
| 383 | assert.Equal(t, "55:3", changes.Last_Seq.String()) |
| 384 | assert.True(t, changes.Results[0].Revoked) |
| 385 | |
| 386 | revocationTester.fillToSeq(74) |
| 387 | revocationTester.addRoleChannel("foo", "ch1") |
| 388 | revocationTester.fillToSeq(80) |
| 389 | |
| 390 | changes = revocationTester.getChanges(50, 1) |
| 391 | assert.Equal(t, "75:3", changes.Last_Seq.String()) |
| 392 | |
| 393 | revocationTester.fillToSeq(84) |
| 394 | revocationTester.removeRoleChannel("foo", "ch1") |
| 395 | revocationTester.fillToSeq(94) |
| 396 | revocationTester.removeRole("user", "foo") |
| 397 | revocationTester.fillToSeq(110) |
| 398 | |
| 399 | changes = revocationTester.getChanges(80, 1) |
| 400 | assert.Equal(t, "85:3", changes.Last_Seq.String()) |
| 401 | assert.True(t, changes.Results[0].Revoked) |
| 402 | } |
| 403 | |
| 404 | func TestRevocationScenario5(t *testing.T) { |
| 405 | defer db.SuspendSequenceBatching()() |
nothing calls this directly
no test coverage detected