             set: sinon.spy()
             send: sinon.spy()
             redirect: sinon.spy()
-          next = sinon.spy()
+          next = sinon.spy (error) ->
+            err = error
+            done()
+
+          signout(req, res, next)
+
+        after ->
+          Client.get.restore()
+
+        it 'should provide an error', ->
+          next.should.have.been.calledWith new Error()
+
+
+      describe 'and unknown client', ->
+
+        before (done) ->
+          opbs = 'b3f0r3'
+          req =
+            query:
+              post_logout_redirect_uri: 'http://example.com'
+              id_token_hint: validIDToken
+            session:
+              opbs: opbs
+            logout: sinon.spy()
+          res =
+            set: sinon.spy()
+            send: sinon.spy()
+            redirect: sinon.spy()
+          next = sinon.spy (error) ->
+            err = error
+            done()
+
           signout(req, res, next)
 
         it 'should not update OP browser state', ->
           req.session.opbs.should.equal opbs
 
-        #it 'should provide an error', ->
-        #  next.should.have.been.called
+        it 'should provide an error', ->
+          next.should.have.been.called
 
         it 'should not redirect', ->
           res.redirect.should.not.have.been.called

      })

    it 'should respond with Pragma header', ->
      console.log()
      console.log()
      console.log(res.set.firstCall)
      console.log()
      console.log()

      res.set.should.have.been.calledWith sinon.match({
        'Pragma': 'no-cache'
      })



settings = require '../../boot/settings'
Client = require '../../models/Client'
IDToken = require '../../models/IDToken'
{signout} = require('../../oidc')


