more test fixing
This commit is contained in:
@@ -17,7 +17,7 @@ var async = require('async'),
|
||||
maildb = require('../maildb.js'),
|
||||
mailer = require('../mailer.js'),
|
||||
paths = require('../paths.js'),
|
||||
settings = require('../settings.js'),
|
||||
provision = require('../provision.js'),
|
||||
userdb = require('../userdb.js'),
|
||||
users = require('../users.js'),
|
||||
_ = require('underscore');
|
||||
@@ -70,8 +70,7 @@ function setup(done) {
|
||||
async.series([
|
||||
database.initialize,
|
||||
database._clear,
|
||||
domains.add.bind(null, DOMAIN_0.domain, DOMAIN_0, AUDIT_SOURCE),
|
||||
settings.setAdminLocation.bind(null, DOMAIN_0.domain, 'my.' + DOMAIN_0.domain),
|
||||
provision.setup.bind(null, DOMAIN_0, { provider: 'generic' }, AUDIT_SOURCE),
|
||||
], done);
|
||||
}
|
||||
|
||||
@@ -316,7 +315,7 @@ describe('User', function () {
|
||||
fs.writeFileSync(paths.GHOST_USER_FILE, JSON.stringify(ghost), 'utf8');
|
||||
|
||||
users.verify(userObject.id, PASSWORD, users.AP_WEBADMIN, function (error, result) {
|
||||
if (fs.existsSync(paths.GHOST_USER_FILE)) return done(new Error('Ghost file exists after verification'));
|
||||
if (!fs.existsSync(paths.GHOST_USER_FILE)) return done(new Error('Ghost file went way without verification'));
|
||||
|
||||
expect(error).to.not.be.ok();
|
||||
expect(result).to.be.ok();
|
||||
@@ -386,6 +385,7 @@ describe('User', function () {
|
||||
fs.writeFileSync(paths.GHOST_USER_FILE, JSON.stringify(ghost), 'utf8');
|
||||
|
||||
users.verifyWithUsername(USERNAME, 'foobar', users.AP_WEBADMIN, function (error) {
|
||||
if (!fs.existsSync(paths.GHOST_USER_FILE)) return done(new Error('Ghost file went way without verification'));
|
||||
fs.unlinkSync(paths.GHOST_USER_FILE);
|
||||
|
||||
expect(error).to.be.a(BoxError);
|
||||
@@ -401,7 +401,7 @@ describe('User', function () {
|
||||
fs.writeFileSync(paths.GHOST_USER_FILE, JSON.stringify(ghost), 'utf8');
|
||||
|
||||
users.verifyWithUsername(USERNAME, 'testpassword', users.AP_WEBADMIN, function (error, result) {
|
||||
fs.unlinkSync(paths.GHOST_USER_FILE);
|
||||
if (fs.existsSync(paths.GHOST_USER_FILE)) return done(new Error('Ghost file still around!'));
|
||||
|
||||
expect(error).to.equal(null);
|
||||
expect(result.id).to.equal(userObject.id);
|
||||
@@ -473,6 +473,7 @@ describe('User', function () {
|
||||
fs.writeFileSync(paths.GHOST_USER_FILE, JSON.stringify(ghost), 'utf8');
|
||||
|
||||
users.verifyWithEmail(EMAIL, 'foobar', users.AP_WEBADMIN, function (error) {
|
||||
if (!fs.existsSync(paths.GHOST_USER_FILE)) return done(new Error('Ghost file not found after failed login!'));
|
||||
fs.unlinkSync(paths.GHOST_USER_FILE);
|
||||
|
||||
expect(error).to.be.a(BoxError);
|
||||
@@ -488,7 +489,7 @@ describe('User', function () {
|
||||
fs.writeFileSync(paths.GHOST_USER_FILE, JSON.stringify(ghost), 'utf8');
|
||||
|
||||
users.verifyWithEmail(EMAIL, 'testpassword', users.AP_WEBADMIN, function (error, result) {
|
||||
fs.unlinkSync(paths.GHOST_USER_FILE);
|
||||
if (fs.existsSync(paths.GHOST_USER_FILE)) return done(new Error('Ghost file still around!'));
|
||||
|
||||
expect(error).to.equal(null);
|
||||
expect(result.id).to.equal(userObject.id);
|
||||
|
||||
Reference in New Issue
Block a user