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

Function TestRevocationScenario7

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

Source from the content-addressed store, hash-verified

495}
496
497func TestRevocationScenario7(t *testing.T) {
498 defer db.SuspendSequenceBatching()()
499
500 revocationTester, rt := InitScenario(t, nil)
501 defer rt.Close()
502
503 resp := rt.SendAdminRequest("PUT", "/{{.keyspace}}/doc1", `{"channels": "ch1"}`)
504 RequireStatus(t, resp, http.StatusCreated)
505
506 revocationTester.fillToSeq(4)
507 revocationTester.addRoleChannel("foo", "ch1")
508
509 changes := revocationTester.getChanges(5, 0)
510 assert.Equal(t, "5", changes.Last_Seq.String())
511
512 revocationTester.fillToSeq(19)
513 revocationTester.addRole("user", "foo")
514 revocationTester.fillToSeq(25)
515
516 changes = revocationTester.getChanges(5, 1)
517 assert.Equal(t, "20:3", changes.Last_Seq.String())
518
519 revocationTester.fillToSeq(44)
520 revocationTester.removeRole("user", "foo")
521 revocationTester.fillToSeq(54)
522 revocationTester.removeRoleChannel("foo", "ch1")
523 revocationTester.fillToSeq(64)
524 revocationTester.addRole("user", "foo")
525 revocationTester.fillToSeq(74)
526 revocationTester.addRoleChannel("foo", "ch1")
527 revocationTester.fillToSeq(84)
528 revocationTester.removeRoleChannel("foo", "ch1")
529 revocationTester.fillToSeq(94)
530 revocationTester.removeRole("user", "foo")
531
532 revocationTester.fillToSeq(100)
533
534 changes = revocationTester.getChanges(25, 1)
535 assert.Equal(t, "45:3", changes.Last_Seq.String())
536 assert.True(t, changes.Results[0].Revoked)
537
538 revocationTester.fillToSeq(110)
539
540 changes = revocationTester.getChanges(100, 0)
541 assert.Equal(t, "100", changes.Last_Seq.String())
542}
543
544func TestRevocationScenario8(t *testing.T) {
545 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