Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Exception in JS sync function when put empty doc for requireAccess tests #137

Closed
andreibaranouski opened this Issue Sep 24, 2013 · 4 comments

Comments

Projects
None yet
3 participants
test("requireAccess, put empty doc", function(t){
  // try to put empty doc for coolio user
  var doc = {}
  coax.put([userUrl, "db", "cooliosdoc50"], doc, function(err, ok){
    console.log("put1 for coolio user", err)
    t.ok(err, "shouldn't allow write empty doc(without any grands")
    t.ok(err.error=='Forbidden', "wrong error response for empty doc, expected:{ error: 'Forbidden', reason: 'wrong user' }")      
        t.end()
   })
  })

not sure of the expected response in this case, but also the server response is incorrect

18:06:28.416555 HTTP:  #007: PUT /db/cooliosdoc50  (as coolio)
18:06:28.486407 WARNING: Sync fn exception: TypeError; doc = map[_rev:1-ca9ad22802b66f662ff171f226211d5c _id:cooliosdoc50] -- db.(*Database).getChannelsAndAccess() at crud.go:534
18:06:28.486466 HTTP:  #007:     --> 500 Exception in JS sync function
put1 for coolio user { error: 'Internal Server Error',
  reason: 'Exception in JS sync function' }

ok 10 shouldn't allow write empty doc(without any grands
not ok 11 wrong error response for empty doc, expected:{ error: 'Forbidden', reason: 'wrong user' }
  ---
    file:   /Users/andrei/couchbase_src/cblite-tests/node_modules/coax/node_modules/hoax/lib/hoax-core.js
    line:   19
    column: 11
    stack:  
      - getCaller (/Users/andrei/couchbase_src/cblite-tests/node_modules/tap/lib/tap-assert.js:418:17)
      - Function.assert (/Users/andrei/couchbase_src/cblite-tests/node_modules/tap/lib/tap-assert.js:21:16)
      - Test._testAssert [as ok] (/Users/andrei/couchbase_src/cblite-tests/node_modules/tap/lib/tap-test.js:87:16)
      - /Users/andrei/couchbase_src/cblite-tests/tests/sync-function.js:178:4

@ghost ghost assigned jchris Sep 24, 2013

Chris, maybe we just have to handle this situation in sync-function? If so, then I just will update its

Contributor

jchris commented Sep 24, 2013

Yes this is a bug in the test sync function.

On Tuesday, September 24, 2013, Andrei Baranouski wrote:

Chris, maybe we just have to handle this situation in sync-function? If
so, then I just will update its


Reply to this email directly or view it on GitHubhttps://github.com/couchbase/couchbase-lite-ios/issues/137#issuecomment-25019510
.

Chris Anderson
http://jchrisa.net
http://www.couchbase.com

Member

snej commented Oct 15, 2013

I'm confused. Isn't this a gateway bug, not Couchbase Lite? And if it's a bug in the function, shouldn't the bug be closed?

it can be closed because test sync_function https://github.com/couchbaselabs/cblite-tests/blob/requireAccess/config/sync_function_test.json does not handle the creation of empty documents( when doc.channels is not specified).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment