       daisy queue
 
 
+  it 'should send HTTP and be able to login user with valid request', (done) ->
+
+    withConvertedUserAndApiToken { createGroup : yes }, ({ group, apiToken }) ->
+      createUserAndSsoToken apiToken.code, ({ token }) ->
+
+        ssoTokenLoginRequestParams = generateSsoTokenLoginRequestParams
+          qs : { token }
+          url : { subdomain : group.slug }
+
+        request.get ssoTokenLoginRequestParams, (err, res, body) ->
+          expect(err).to.not.exist
+          expect(res.statusCode).to.be.equal 200
+          expect(body).not.to.be.empty
+          done()
+
+
+
 beforeTests()
 
 runTests()

  it 'should send HTTP 400 if there is no group in jwt token', (done) ->

    ssoTokenLoginRequestParams = generateSsoTokenLoginRequestParams
      body : { token : JUser.createJWT { username : 'someUsername' } }

    request.post ssoTokenLoginRequestParams, (err, res, body) ->
      expect(err).to.not.exist
      expect(res.statusCode).to.be.equal 400
      expect(body).to.be.equal 'no group slug in token'

    withConvertedUserAndApiToken { createGroup : yes }, ({ group }) ->
      token = JUser.createJWT { username: 'non-existent-user', group : group.slug }
      ssoTokenLoginRequestParams = generateSsoTokenLoginRequestParams
        qs  : { token }
        url : { subdomain : group.slug }

      request.get ssoTokenLoginRequestParams, (err, res, body) ->
        expect(err).to.not.exist
        expect(res.statusCode).to.be.equal 400
        expect(body).to.be.equal 'invalid username!'
