Fixup the unit tests

This commit is contained in:
Johannes Zellner
2016-06-03 15:07:44 +02:00
parent 226537de04
commit 3ad2a2a5ca
4 changed files with 23 additions and 22 deletions
+1 -2
View File
@@ -12,7 +12,6 @@ var appdb = require('../../appdb.js'),
path = require('path'),
async = require('async'),
child_process = require('child_process'),
clientdb = require('../../clientdb.js'),
clients = require('../../clients.js'),
config = require('../../config.js'),
constants = require('../../constants.js'),
@@ -710,7 +709,7 @@ describe('Apps', function () {
appContainer.inspect(function (error, data) {
expect(error).to.not.be.ok();
clients.getByAppIdAndType(APP_ID, clientdb.TYPE_OAUTH, function (error, client) {
clients.getByAppIdAndType(APP_ID, clients.TYPE_OAUTH, function (error, client) {
expect(error).to.not.be.ok();
expect(client.id.length).to.be(40); // cid- + 32 hex chars (128 bits) + 4 hyphens
expect(client.clientSecret.length).to.be(64); // 32 hex chars (256 bits)
+2 -2
View File
@@ -8,7 +8,7 @@
var async = require('async'),
config = require('../../config.js'),
clientdb = require('../../clientdb.js'),
clients = require('../../clients.js'),
database = require('../../database.js'),
oauth2 = require('../oauth2.js'),
expect = require('expect.js'),
@@ -174,7 +174,7 @@ describe('OAuth Clients API', function () {
expect(result.body.redirectURI).to.be.a('string');
expect(result.body.clientSecret).to.be.a('string');
expect(result.body.scope).to.be.a('string');
expect(result.body.type).to.equal(clientdb.TYPE_EXTERNAL);
expect(result.body.type).to.equal(clients.TYPE_EXTERNAL);
done();
});
+11 -10
View File
@@ -18,6 +18,7 @@ var expect = require('expect.js'),
querystring = require('querystring'),
database = require('../../database.js'),
clientdb = require('../../clientdb.js'),
clients = require('../../clients.js'),
userdb = require('../../userdb.js'),
user = require('../../user.js'),
appdb = require('../../appdb.js'),
@@ -197,7 +198,7 @@ describe('OAuth2', function () {
var CLIENT_0 = {
id: 'cid-client0',
appId: 'appid-app0',
type: clientdb.TYPE_OAUTH,
type: clients.TYPE_OAUTH,
clientSecret: 'secret0',
redirectURI: 'http://redirect0',
scope: 'profile'
@@ -207,7 +208,7 @@ describe('OAuth2', function () {
var CLIENT_1 = {
id: 'cid-client1',
appId: 'appid-app1',
type: clientdb.TYPE_OAUTH,
type: clients.TYPE_OAUTH,
clientSecret: 'secret1',
redirectURI: 'http://redirect1',
scope: 'profile'
@@ -217,7 +218,7 @@ describe('OAuth2', function () {
var CLIENT_2 = {
id: 'cid-client2',
appId: APP_0.id,
type: clientdb.TYPE_OAUTH,
type: clients.TYPE_OAUTH,
clientSecret: 'secret2',
redirectURI: 'http://redirect2',
scope: 'profile'
@@ -227,7 +228,7 @@ describe('OAuth2', function () {
var CLIENT_3 = {
id: 'cid-client3',
appId: APP_0.id,
type: clientdb.TYPE_OAUTH,
type: clients.TYPE_OAUTH,
clientSecret: 'secret3',
redirectURI: 'http://redirect1',
scope: 'profile'
@@ -237,7 +238,7 @@ describe('OAuth2', function () {
var CLIENT_4 = {
id: 'cid-client4',
appId: 'appid-app4',
type: clientdb.TYPE_PROXY,
type: clients.TYPE_PROXY,
clientSecret: 'secret4',
redirectURI: 'http://redirect4',
scope: 'profile'
@@ -247,7 +248,7 @@ describe('OAuth2', function () {
var CLIENT_5 = {
id: 'cid-client5',
appId: APP_0.id,
type: clientdb.TYPE_PROXY,
type: clients.TYPE_PROXY,
clientSecret: 'secret5',
redirectURI: 'http://redirect5',
scope: 'profile'
@@ -257,7 +258,7 @@ describe('OAuth2', function () {
var CLIENT_6 = {
id: 'cid-client6',
appId: APP_1.id,
type: clientdb.TYPE_OAUTH,
type: clients.TYPE_OAUTH,
clientSecret: 'secret6',
redirectURI: 'http://redirect6',
scope: 'profile'
@@ -267,7 +268,7 @@ describe('OAuth2', function () {
var CLIENT_7 = {
id: 'cid-client7',
appId: APP_2.id,
type: clientdb.TYPE_OAUTH,
type: clients.TYPE_OAUTH,
clientSecret: 'secret7',
redirectURI: 'http://redirect7',
scope: 'profile'
@@ -277,7 +278,7 @@ describe('OAuth2', function () {
var CLIENT_8 = {
id: 'cid-client8',
appId: APP_2.id,
type: clientdb.TYPE_SIMPLE_AUTH,
type: clients.TYPE_SIMPLE_AUTH,
clientSecret: 'secret8',
redirectURI: 'http://redirect8',
scope: 'profile'
@@ -287,7 +288,7 @@ describe('OAuth2', function () {
var CLIENT_9 = {
id: 'cid-client9',
appId: APP_3.id,
type: clientdb.TYPE_OAUTH,
type: clients.TYPE_OAUTH,
clientSecret: 'secret9',
redirectURI: 'http://redirect9',
scope: 'profile'
+9 -8
View File
@@ -6,9 +6,10 @@
'use strict';
var clientdb = require('../../clientdb.js'),
appdb = require('../../appdb.js'),
var appdb = require('../../appdb.js'),
async = require('async'),
clientdb = require('../../clientdb.js'),
clients = require('../../clients.js'),
config = require('../../config.js'),
database = require('../../database.js'),
expect = require('expect.js'),
@@ -70,7 +71,7 @@ describe('SimpleAuth API', function () {
var CLIENT_0 = {
id: 'someclientid',
appId: 'someappid',
type: clientdb.TYPE_SIMPLE_AUTH,
type: clients.TYPE_SIMPLE_AUTH,
clientSecret: 'someclientsecret',
redirectURI: '',
scope: 'user,profile'
@@ -79,7 +80,7 @@ describe('SimpleAuth API', function () {
var CLIENT_1 = {
id: 'someclientid1',
appId: APP_0.id,
type: clientdb.TYPE_SIMPLE_AUTH,
type: clients.TYPE_SIMPLE_AUTH,
clientSecret: 'someclientsecret1',
redirectURI: '',
scope: 'user,profile'
@@ -88,7 +89,7 @@ describe('SimpleAuth API', function () {
var CLIENT_2 = {
id: 'someclientid2',
appId: APP_1.id,
type: clientdb.TYPE_SIMPLE_AUTH,
type: clients.TYPE_SIMPLE_AUTH,
clientSecret: 'someclientsecret2',
redirectURI: '',
scope: 'user,profile'
@@ -97,7 +98,7 @@ describe('SimpleAuth API', function () {
var CLIENT_3 = {
id: 'someclientid3',
appId: APP_2.id,
type: clientdb.TYPE_SIMPLE_AUTH,
type: clients.TYPE_SIMPLE_AUTH,
clientSecret: 'someclientsecret3',
redirectURI: '',
scope: 'user,profile'
@@ -106,7 +107,7 @@ describe('SimpleAuth API', function () {
var CLIENT_4 = {
id: 'someclientid4',
appId: APP_2.id,
type: clientdb.TYPE_OAUTH,
type: clients.TYPE_OAUTH,
clientSecret: 'someclientsecret4',
redirectURI: '',
scope: 'user,profile'
@@ -115,7 +116,7 @@ describe('SimpleAuth API', function () {
var CLIENT_5 = {
id: 'someclientid5',
appId: APP_3.id,
type: clientdb.TYPE_SIMPLE_AUTH,
type: clients.TYPE_SIMPLE_AUTH,
clientSecret: 'someclientsecret5',
redirectURI: '',
scope: 'user,profile'