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

Function TestRevocationScenario8

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

Source from the content-addressed store, hash-verified

542}
543
544func TestRevocationScenario8(t *testing.T) {
545 defer db.SuspendSequenceBatching()()
546
547 revocationTester, rt := InitScenario(t, nil)
548 defer rt.Close()
549
550 resp := rt.SendAdminRequest("PUT", "/{{.keyspace}}/doc1", `{"channels": "ch1"}`)
551 RequireStatus(t, resp, http.StatusCreated)
552
553 revocationTester.fillToSeq(4)
554 revocationTester.addRoleChannel("foo", "ch1")
555
556 changes := revocationTester.getChanges(5, 0)
557 assert.Equal(t, "5", changes.Last_Seq.String())
558
559 revocationTester.fillToSeq(19)
560 revocationTester.addRole("user", "foo")
561 revocationTester.fillToSeq(44)
562 revocationTester.removeRole("user", "foo")
563
564 revocationTester.fillToSeq(50)
565 changes = revocationTester.getChanges(5, 0)
566 assert.Equal(t, "5", changes.Last_Seq.String())
567
568 revocationTester.fillToSeq(54)
569 revocationTester.removeRoleChannel("foo", "ch1")
570 revocationTester.fillToSeq(64)
571 revocationTester.addRole("user", "foo")
572 revocationTester.fillToSeq(74)
573 revocationTester.addRoleChannel("foo", "ch1")
574 revocationTester.fillToSeq(84)
575 revocationTester.removeRoleChannel("foo", "ch1")
576 revocationTester.fillToSeq(94)
577 revocationTester.removeRole("user", "foo")
578
579 revocationTester.fillToSeq(110)
580 changes = revocationTester.getChanges(50, 0)
581 assert.Equal(t, "50", changes.Last_Seq.String())
582}
583
584func TestRevocationScenario9(t *testing.T) {
585 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