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

Function TestRevocationScenario11

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

Source from the content-addressed store, hash-verified

662}
663
664func TestRevocationScenario11(t *testing.T) {
665 defer db.SuspendSequenceBatching()()
666
667 revocationTester, rt := InitScenario(t, nil)
668 defer rt.Close()
669
670 resp := rt.SendAdminRequest("PUT", "/{{.keyspace}}/doc1", `{"channels": "ch1"}`)
671 RequireStatus(t, resp, http.StatusCreated)
672
673 revocationTester.fillToSeq(4)
674 revocationTester.addRoleChannel("foo", "ch1")
675
676 changes := revocationTester.getChanges(5, 0)
677 assert.Equal(t, "5", changes.Last_Seq.String())
678
679 revocationTester.fillToSeq(19)
680 revocationTester.addRole("user", "foo")
681 revocationTester.fillToSeq(44)
682 revocationTester.removeRole("user", "foo")
683 revocationTester.fillToSeq(54)
684 revocationTester.removeRoleChannel("foo", "ch1")
685 revocationTester.fillToSeq(64)
686 revocationTester.addRole("user", "foo")
687 revocationTester.fillToSeq(74)
688 revocationTester.addRoleChannel("foo", "ch1")
689
690 revocationTester.fillToSeq(80)
691 changes = revocationTester.getChanges(5, 1)
692 assert.Equal(t, "75:3", changes.Last_Seq.String())
693
694 revocationTester.fillToSeq(84)
695 revocationTester.removeRoleChannel("foo", "ch1")
696 revocationTester.fillToSeq(94)
697 revocationTester.removeRole("user", "foo")
698
699 revocationTester.fillToSeq(110)
700 changes = revocationTester.getChanges(80, 1)
701 assert.Equal(t, "85:3", changes.Last_Seq.String())
702 assert.True(t, changes.Results[0].Revoked)
703}
704
705func TestRevocationScenario12(t *testing.T) {
706 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