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

Function InitScenario

rest/revocation_test.go:150–195  ·  view source on GitHub ↗
(t testing.TB, rtConfig *RestTesterConfig)

Source from the content-addressed store, hash-verified

148}
149
150func InitScenario(t testing.TB, rtConfig *RestTesterConfig) (ChannelRevocationTester, *RestTester) {
151
152 defaultSyncFn := `
153 function (doc, oldDoc){
154 if (doc._id === 'userRoles'){
155 for (var key in doc.roles){
156 role(key, doc.roles[key]);
157 }
158 }
159 if (doc._id === 'roleChannels'){
160 for (var key in doc.channels){
161 access(key, doc.channels[key]);
162 }
163 }
164 if (doc._id === 'userChannels'){
165 for (var key in doc.channels){
166 access(key, doc.channels[key]);
167 }
168 }
169 if (doc._id.indexOf("doc") >= 0){
170 channel(doc.channels);
171 }
172 }`
173
174 if rtConfig == nil {
175 rtConfig = &RestTesterConfig{
176 SyncFn: defaultSyncFn,
177 }
178 } else if rtConfig.SyncFn == "" {
179 rtConfig.SyncFn = defaultSyncFn
180 }
181
182 rt := NewRestTester(t, rtConfig)
183
184 revocationTester := ChannelRevocationTester{
185 test: rt.TB(),
186 restTester: rt,
187 }
188
189 rt.CreateUser(revocationTestUser, nil)
190
191 resp := rt.SendAdminRequest("PUT", "/{{.db}}/_role/foo", `{}`)
192 RequireStatus(t, resp, http.StatusCreated)
193
194 return revocationTester, rt
195}
196
197func TestRevocationScenario1(t *testing.T) {
198 defer db.SuspendSequenceBatching()()

Callers 15

TestRevocationScenario1Function · 0.85
TestRevocationScenario2Function · 0.85
TestRevocationScenario3Function · 0.85
TestRevocationScenario4Function · 0.85
TestRevocationScenario5Function · 0.85
TestRevocationScenario6Function · 0.85
TestRevocationScenario7Function · 0.85
TestRevocationScenario8Function · 0.85
TestRevocationScenario9Function · 0.85
TestRevocationScenario10Function · 0.85
TestRevocationScenario11Function · 0.85
TestRevocationScenario12Function · 0.85

Calls 5

TBMethod · 0.95
CreateUserMethod · 0.95
SendAdminRequestMethod · 0.95
NewRestTesterFunction · 0.85
RequireStatusFunction · 0.85

Tested by

no test coverage detected