(t *testing.T)
| 298 | } |
| 299 | |
| 300 | func TestRevocationScenario3(t *testing.T) { |
| 301 | defer db.SuspendSequenceBatching()() |
| 302 | |
| 303 | revocationTester, rt := InitScenario(t, nil) |
| 304 | defer rt.Close() |
| 305 | |
| 306 | resp := rt.SendAdminRequest("PUT", "/{{.keyspace}}/doc1", `{"channels": "ch1"}`) |
| 307 | RequireStatus(t, resp, http.StatusCreated) |
| 308 | |
| 309 | revocationTester.fillToSeq(4) |
| 310 | revocationTester.addRoleChannel("foo", "ch1") |
| 311 | |
| 312 | changes := revocationTester.getChanges(5, 0) |
| 313 | assert.Equal(t, "5", changes.Last_Seq.String()) |
| 314 | |
| 315 | revocationTester.fillToSeq(19) |
| 316 | revocationTester.addRole("user", "foo") |
| 317 | revocationTester.fillToSeq(25) |
| 318 | |
| 319 | changes = revocationTester.getChanges(5, 1) |
| 320 | assert.Equal(t, "20:3", changes.Last_Seq.String()) |
| 321 | |
| 322 | revocationTester.fillToSeq(44) |
| 323 | revocationTester.removeRole("user", "foo") |
| 324 | revocationTester.fillToSeq(54) |
| 325 | revocationTester.removeRoleChannel("foo", "ch1") |
| 326 | |
| 327 | revocationTester.fillToSeq(60) |
| 328 | changes = revocationTester.getChanges(25, 1) |
| 329 | assert.Equal(t, "45:3", changes.Last_Seq.String()) |
| 330 | assert.True(t, changes.Results[0].Revoked) |
| 331 | |
| 332 | revocationTester.fillToSeq(64) |
| 333 | revocationTester.addRole("user", "foo") |
| 334 | revocationTester.fillToSeq(74) |
| 335 | revocationTester.addRoleChannel("foo", "ch1") |
| 336 | revocationTester.fillToSeq(80) |
| 337 | |
| 338 | changes = revocationTester.getChanges(50, 1) |
| 339 | assert.Equal(t, "75:3", changes.Last_Seq.String()) |
| 340 | |
| 341 | revocationTester.fillToSeq(84) |
| 342 | revocationTester.removeRoleChannel("foo", "ch1") |
| 343 | revocationTester.fillToSeq(94) |
| 344 | revocationTester.removeRole("user", "foo") |
| 345 | revocationTester.fillToSeq(110) |
| 346 | |
| 347 | changes = revocationTester.getChanges(80, 1) |
| 348 | assert.Equal(t, "85:3", changes.Last_Seq.String()) |
| 349 | assert.True(t, changes.Results[0].Revoked) |
| 350 | } |
| 351 | |
| 352 | func TestRevocationScenario4(t *testing.T) { |
| 353 | defer db.SuspendSequenceBatching()() |
nothing calls this directly
no test coverage detected