MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestRevocationScenario5

Function TestRevocationScenario5

rest/revocation_test.go:404–448  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

402}
403
404func 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
450func TestRevocationScenario6(t *testing.T) {
451 defer db.SuspendSequenceBatching()()

Callers

nothing calls this directly

Calls 13

SuspendSequenceBatchingFunction · 0.92
InitScenarioFunction · 0.85
RequireStatusFunction · 0.85
SendAdminRequestMethod · 0.80
fillToSeqMethod · 0.80
addRoleChannelMethod · 0.80
getChangesMethod · 0.80
CloseMethod · 0.65
StringMethod · 0.65
EqualMethod · 0.45
addRoleMethod · 0.45
removeRoleMethod · 0.45

Tested by

no test coverage detected