text: // Load modules
  
  var Bell = require('../../');
  var Code = require('code');
  var Hapi = require('hapi');
  var Hoek = require('hoek');
  var Lab = require('lab');
  var Mock = require('../mock');
  
  
  // Declare internals
  
  var internals = {};
  
  
  // Test shortcuts
  
  var lab = exports.lab = Lab.script();
  var describe = lab.describe;
  var it = lab.it;
  var expect = Code.expect;
  
  
  describe('twitter', function () {
  
      it('authenticates with mock', { parallel: false }, function (done) {
  
          var mock = new Mock.V1();
          mock.start(function (provider) {
  
              var server = new Hapi.Server();
              server.connection({ host: 'localhost', port: 80 });
              server.register(Bell, function (err) {
  
                  expect(err).to.not.exist();
  
                  var custom = Bell.providers.twitter();
                  Hoek.merge(custom, provider);
  
                  Mock.override('https://api.twitter.com/1.1/users/show.json', {
                      property: 'something'
                  });
  
                  server.auth.strategy('custom', 'bell', {
                      password: 'password',
                      isSecure: false,
                      clientId: 'twitter',
                      clientSecret: 'secret',
                      provider: custom
                  });
  
                  server.route({
                      method: '*',
                      path: '/login',
                      config: {
                          auth: 'custom',
                          handler: function (request, reply) {
  
                              reply(request.auth.credentials);
                          }
                      }
                  });
  
                  server.inject('/login', function (res) {
  
                      var cookie = res.headers['set-cookie'][0].split(';')[0] + ';';
                      mock.server.inject(res.headers.location, function (mockRes) {
  
                          server.inject({ url: mockRes.headers.location, headers: { cookie: cookie } }, function (response) {
  
                              Mock.clear();
                              expect(response.result).to.deep.equal({
                                  provider: 'custom',
                                  token: 'final',
                                  secret: 'secret',
                                  query: {},
                                  profile: {
                                      id: '1234567890',
                                      username: 'Steve Stevens',
                                      displayName: undefined,
                                      raw: {
                                          property: 'something'
                                      }
                                  }
                              });
  
                              mock.stop(done);
                          });
                      });
                  });
              });
          });
      });
  
      it('authenticates with mock (without extended profile)', { parallel: false }, function (done) {
  
          var mock = new Mock.V1();
          mock.start(function (provider) {
  
              var server = new Hapi.Server();
              server.connection({ host: 'localhost', port: 80 });
              server.register(Bell, function (err) {
  
                  expect(err).to.not.exist();
  
                  var custom = Bell.providers.twitter({ extendedProfile: false });
                  Hoek.merge(custom, provider);
  
                  server.auth.strategy('custom', 'bell', {
                      password: 'password',
                      isSecure: false,
                      clientId: 'twitter',
                      clientSecret: 'secret',
                      provider: custom
                  });
  
                  server.route({
                      method: '*',
                      path: '/login',
                      config: {
                          auth: 'custom',
                          handler: function (request, reply) {
  
                              reply(request.auth.credentials);
                          }
                      }
                  });
  
                  server.inject('/login', function (res) {
  
                      var cookie = res.headers['set-cookie'][0].split(';')[0] + ';';
                      mock.server.inject(res.headers.location, function (mockRes) {
  
                          server.inject({ url: mockRes.headers.location, headers: { cookie: cookie } }, function (response) {
  
                              expect(response.result).to.deep.equal({
                                  provider: 'custom',
                                  token: 'final',
                                  secret: 'secret',
                                  query: {},
                                  profile: {
                                      id: '1234567890',
                                      username: 'Steve Stevens'
                                  }
                              });
  
                              mock.stop(done);
                          });
                      });
                  });
              });
          });
      });
  });
  