     request.get ssoTokenLoginRequestParams, (err, res, body) ->
       expect(err).to.not.exist
       expect(res.statusCode).to.be.equal 400
-      expect(body).to.be.equal 'no username in token'
+      expect(JSON.parse body).to.be.deep.equal { error : apiErrors.invalidSSOTokenPayload }
       done()
 
 

    request.get ssoTokenLoginRequestParams, (err, res, body) ->
      expect(err).to.not.exist
      expect(res.statusCode).to.be.equal 400
      expect(body).to.be.equal 'token is required'
      done()



{ generateSsoTokenLoginRequestParams } = require '../../../../testhelper/handler/ssotokenloginhelper'
{ createUserAndSsoToken }              = require '../../../../testhelper/handler/createssotokenhelper'

JUser     = require '../../../../models/user'
JAccount  = require '../../../../models/account'
apiErrors = require './errors'

beforeTests = -> before (done) ->

