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

Function TestRevocationScenario6

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

Source from the content-addressed store, hash-verified

448}
449
450func TestRevocationScenario6(t *testing.T) {
451 defer db.SuspendSequenceBatching()()
452
453 revocationTester, rt := InitScenario(t, nil)
454 defer rt.Close()
455
456 resp := rt.SendAdminRequest("PUT", "/{{.keyspace}}/doc1", `{"channels": "ch1"}`)
457 RequireStatus(t, resp, http.StatusCreated)
458
459 revocationTester.fillToSeq(4)
460 revocationTester.addRoleChannel("foo", "ch1")
461
462 changes := revocationTester.getChanges(5, 0)
463 assert.Equal(t, "5", changes.Last_Seq.String())
464
465 revocationTester.fillToSeq(19)
466 revocationTester.addRole("user", "foo")
467 revocationTester.fillToSeq(25)
468
469 changes = revocationTester.getChanges(5, 1)
470 assert.Equal(t, "20:3", changes.Last_Seq.String())
471
472 revocationTester.fillToSeq(44)
473 revocationTester.removeRole("user", "foo")
474 revocationTester.fillToSeq(54)
475 revocationTester.removeRoleChannel("foo", "ch1")
476 revocationTester.fillToSeq(64)
477 revocationTester.addRole("user", "foo")
478 revocationTester.fillToSeq(74)
479 revocationTester.addRoleChannel("foo", "ch1")
480 revocationTester.fillToSeq(84)
481 revocationTester.removeRoleChannel("foo", "ch1")
482
483 revocationTester.fillToSeq(90)
484
485 changes = revocationTester.getChanges(25, 1)
486 assert.Equal(t, "55:3", changes.Last_Seq.String())
487 assert.True(t, changes.Results[0].Revoked)
488
489 revocationTester.fillToSeq(94)
490 revocationTester.removeRole("user", "foo")
491 revocationTester.fillToSeq(110)
492
493 changes = revocationTester.getChanges(90, 0)
494 assert.Equal(t, "90", changes.Last_Seq.String())
495}
496
497func TestRevocationScenario7(t *testing.T) {
498 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