Remove oauth
A whole bunch of useless stuff
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
var appdb = require('../appdb.js'),
|
||||
apps = require('../apps.js'),
|
||||
async = require('async'),
|
||||
authcodedb = require('../authcodedb.js'),
|
||||
backupdb = require('../backupdb.js'),
|
||||
BoxError = require('../boxerror.js'),
|
||||
clientdb = require('../clientdb.js'),
|
||||
@@ -716,108 +715,6 @@ describe('database', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('authcode', function () {
|
||||
var AUTHCODE_0 = {
|
||||
authCode: 'authcode-0',
|
||||
clientId: 'clientid-0',
|
||||
userId: 'userid-0',
|
||||
expiresAt: Date.now() + 500000
|
||||
};
|
||||
var AUTHCODE_1 = {
|
||||
authCode: 'authcode-1',
|
||||
clientId: 'clientid-1',
|
||||
userId: 'userid-1',
|
||||
expiresAt: Date.now() + 500000
|
||||
};
|
||||
var AUTHCODE_2 = {
|
||||
authCode: 'authcode-2',
|
||||
clientId: 'clientid-2',
|
||||
userId: 'userid-2',
|
||||
expiresAt: Date.now()
|
||||
};
|
||||
|
||||
it('add fails due to missing arguments', function () {
|
||||
expect(function () { authcodedb.add(AUTHCODE_0.authCode, AUTHCODE_0.clientId, AUTHCODE_0.userId); }).to.throwError();
|
||||
expect(function () { authcodedb.add(AUTHCODE_0.authCode, AUTHCODE_0.clientId, function () {}); }).to.throwError();
|
||||
expect(function () { authcodedb.add(AUTHCODE_0.authCode, function () {}); }).to.throwError();
|
||||
});
|
||||
|
||||
it('add succeeds', function (done) {
|
||||
authcodedb.add(AUTHCODE_0.authCode, AUTHCODE_0.clientId, AUTHCODE_0.userId, AUTHCODE_0.expiresAt, function (error) {
|
||||
expect(error).to.be(null);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('add of same authcode fails', function (done) {
|
||||
authcodedb.add(AUTHCODE_0.authCode, AUTHCODE_0.clientId, AUTHCODE_0.userId, AUTHCODE_0.expiresAt, function (error) {
|
||||
expect(error).to.be.a(BoxError);
|
||||
expect(error.reason).to.be(BoxError.ALREADY_EXISTS);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('get succeeds', function (done) {
|
||||
authcodedb.get(AUTHCODE_0.authCode, function (error, result) {
|
||||
expect(error).to.be(null);
|
||||
expect(result).to.be.an('object');
|
||||
expect(result).to.be.eql(AUTHCODE_0);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('get of nonexisting code fails', function (done) {
|
||||
authcodedb.get(AUTHCODE_1.authCode, function (error, result) {
|
||||
expect(error).to.be.a(BoxError);
|
||||
expect(error.reason).to.be(BoxError.NOT_FOUND);
|
||||
expect(result).to.not.be.ok();
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('get of expired code fails', function (done) {
|
||||
authcodedb.add(AUTHCODE_2.authCode, AUTHCODE_2.clientId, AUTHCODE_2.userId, AUTHCODE_2.expiresAt, function (error) {
|
||||
expect(error).to.be(null);
|
||||
|
||||
authcodedb.get(AUTHCODE_2.authCode, function (error, result) {
|
||||
expect(error).to.be.a(BoxError);
|
||||
expect(error.reason).to.be(BoxError.NOT_FOUND);
|
||||
expect(result).to.not.be.ok();
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('delExpired succeeds', function (done) {
|
||||
authcodedb.delExpired(function (error, result) {
|
||||
expect(error).to.not.be.ok();
|
||||
expect(result).to.eql(1);
|
||||
|
||||
authcodedb.get(AUTHCODE_2.authCode, function (error, result) {
|
||||
expect(error).to.be.a(BoxError);
|
||||
expect(error.reason).to.be(BoxError.NOT_FOUND);
|
||||
expect(result).to.not.be.ok();
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('delete succeeds', function (done) {
|
||||
authcodedb.del(AUTHCODE_0.authCode, function (error) {
|
||||
expect(error).to.be(null);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('cannot delete previously delete record', function (done) {
|
||||
authcodedb.del(AUTHCODE_0.authCode, function (error) {
|
||||
expect(error).to.be.a(BoxError);
|
||||
expect(error.reason).to.be(BoxError.NOT_FOUND);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('token', function () {
|
||||
var TOKEN_0 = {
|
||||
id: 'tid-0',
|
||||
|
||||
Reference in New Issue
Block a user