(t *testing.T)
| 246 | } |
| 247 | |
| 248 | func TestRevocationScenario2(t *testing.T) { |
| 249 | defer db.SuspendSequenceBatching()() |
| 250 | |
| 251 | revocationTester, rt := InitScenario(t, nil) |
| 252 | defer rt.Close() |
| 253 | |
| 254 | resp := rt.SendAdminRequest("PUT", "/{{.keyspace}}/doc1", `{"channels": "ch1"}`) |
| 255 | RequireStatus(t, resp, http.StatusCreated) |
| 256 | |
| 257 | revocationTester.fillToSeq(4) |
| 258 | revocationTester.addRoleChannel("foo", "ch1") |
| 259 | |
| 260 | changes := revocationTester.getChanges(5, 0) |
| 261 | assert.Equal(t, "5", changes.Last_Seq.String()) |
| 262 | |
| 263 | revocationTester.fillToSeq(19) |
| 264 | revocationTester.addRole("user", "foo") |
| 265 | revocationTester.fillToSeq(25) |
| 266 | |
| 267 | changes = revocationTester.getChanges(5, 1) |
| 268 | assert.Equal(t, "20:3", changes.Last_Seq.String()) |
| 269 | |
| 270 | revocationTester.fillToSeq(44) |
| 271 | revocationTester.removeRole("user", "foo") |
| 272 | |
| 273 | revocationTester.fillToSeq(50) |
| 274 | changes = revocationTester.getChanges(25, 1) |
| 275 | assert.Equal(t, "45:3", changes.Last_Seq.String()) |
| 276 | assert.True(t, changes.Results[0].Revoked) |
| 277 | |
| 278 | revocationTester.fillToSeq(54) |
| 279 | revocationTester.removeRoleChannel("foo", "ch1") |
| 280 | revocationTester.fillToSeq(64) |
| 281 | revocationTester.addRole("user", "foo") |
| 282 | revocationTester.fillToSeq(74) |
| 283 | revocationTester.addRoleChannel("foo", "ch1") |
| 284 | revocationTester.fillToSeq(80) |
| 285 | |
| 286 | changes = revocationTester.getChanges(50, 1) |
| 287 | assert.Equal(t, "75:3", changes.Last_Seq.String()) |
| 288 | |
| 289 | revocationTester.fillToSeq(84) |
| 290 | revocationTester.removeRoleChannel("foo", "ch1") |
| 291 | revocationTester.fillToSeq(94) |
| 292 | revocationTester.removeRole("user", "foo") |
| 293 | revocationTester.fillToSeq(110) |
| 294 | |
| 295 | changes = revocationTester.getChanges(80, 1) |
| 296 | assert.Equal(t, "85:3", changes.Last_Seq.String()) |
| 297 | assert.True(t, changes.Results[0].Revoked) |
| 298 | } |
| 299 | |
| 300 | func TestRevocationScenario3(t *testing.T) { |
| 301 | defer db.SuspendSequenceBatching()() |
nothing calls this directly
no test coverage detected