(t *testing.T)
| 402 | } |
| 403 | |
| 404 | func TestRevocationScenario5(t *testing.T) { |
| 405 | defer db.SuspendSequenceBatching()() |
| 406 | |
| 407 | revocationTester, rt := InitScenario(t, nil) |
| 408 | defer rt.Close() |
| 409 | |
| 410 | resp := rt.SendAdminRequest("PUT", "/{{.keyspace}}/doc1", `{"channels": "ch1"}`) |
| 411 | RequireStatus(t, resp, http.StatusCreated) |
| 412 | |
| 413 | revocationTester.fillToSeq(4) |
| 414 | revocationTester.addRoleChannel("foo", "ch1") |
| 415 | |
| 416 | changes := revocationTester.getChanges(5, 0) |
| 417 | assert.Equal(t, "5", changes.Last_Seq.String()) |
| 418 | |
| 419 | revocationTester.fillToSeq(19) |
| 420 | revocationTester.addRole("user", "foo") |
| 421 | revocationTester.fillToSeq(25) |
| 422 | |
| 423 | changes = revocationTester.getChanges(5, 1) |
| 424 | assert.Equal(t, "20:3", changes.Last_Seq.String()) |
| 425 | |
| 426 | revocationTester.fillToSeq(44) |
| 427 | revocationTester.removeRole("user", "foo") |
| 428 | revocationTester.fillToSeq(54) |
| 429 | revocationTester.removeRoleChannel("foo", "ch1") |
| 430 | revocationTester.fillToSeq(64) |
| 431 | revocationTester.addRole("user", "foo") |
| 432 | revocationTester.fillToSeq(74) |
| 433 | revocationTester.addRoleChannel("foo", "ch1") |
| 434 | revocationTester.fillToSeq(80) |
| 435 | |
| 436 | changes = revocationTester.getChanges(25, 1) |
| 437 | assert.Equal(t, "75:3", changes.Last_Seq.String()) |
| 438 | |
| 439 | revocationTester.fillToSeq(84) |
| 440 | revocationTester.removeRoleChannel("foo", "ch1") |
| 441 | revocationTester.fillToSeq(94) |
| 442 | revocationTester.removeRole("user", "foo") |
| 443 | revocationTester.fillToSeq(110) |
| 444 | |
| 445 | changes = revocationTester.getChanges(80, 1) |
| 446 | assert.Equal(t, "85:3", changes.Last_Seq.String()) |
| 447 | assert.True(t, changes.Results[0].Revoked) |
| 448 | } |
| 449 | |
| 450 | func TestRevocationScenario6(t *testing.T) { |
| 451 | defer db.SuspendSequenceBatching()() |
nothing calls this directly
no test coverage detected