2015-05-27 04:49:23 +03:00
|
|
|
jest.autoMockOff();
|
|
|
|
|
2015-06-19 03:30:08 +03:00
|
|
|
jasmine.getEnv().defaultTimeoutInterval = 60000;
|
|
|
|
|
2015-05-28 00:20:44 +03:00
|
|
|
let hubUtil = require('../src/utils/HubUtil');
|
|
|
|
let Promise = require('bluebird');
|
2015-05-27 04:49:23 +03:00
|
|
|
|
2015-05-28 00:20:44 +03:00
|
|
|
describe('HubUtil Integration Tests', () => {
|
|
|
|
describe('auth', () => {
|
|
|
|
pit('successfully authenticates', () => {
|
|
|
|
return new Promise((resolve) => {
|
2015-06-19 04:00:29 +03:00
|
|
|
hubUtil.auth(process.env.INTEGRATION_USER, process.env.INTEGRATION_PASSWORD, (error, response, body) => {
|
|
|
|
expect(response.statusCode).toBe(200);
|
|
|
|
expect(error).toBe(null);
|
2015-05-27 04:49:23 +03:00
|
|
|
|
2015-06-19 04:00:29 +03:00
|
|
|
let data = JSON.parse(body);
|
|
|
|
expect(data.token).toBeTruthy();
|
|
|
|
resolve();
|
|
|
|
});
|
2015-05-28 00:20:44 +03:00
|
|
|
});
|
2015-05-27 04:49:23 +03:00
|
|
|
});
|
|
|
|
|
2015-05-28 00:20:44 +03:00
|
|
|
pit('provides a 401 if credentials are incorrect', () => {
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
hubUtil.auth(process.env.INTEGRATION_USER, 'incorrectpassword', (error, response) => {
|
|
|
|
expect(response.statusCode).toBe(401);
|
|
|
|
resolve();
|
|
|
|
});
|
|
|
|
});
|
2015-05-27 04:49:23 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|