|
|
|
@ -10,7 +10,6 @@ var db = require('./mocks/databasemock');
|
|
|
|
|
var User = require('../src/user');
|
|
|
|
|
var Topics = require('../src/topics');
|
|
|
|
|
var Categories = require('../src/categories');
|
|
|
|
|
var Meta = require('../src/meta');
|
|
|
|
|
var Password = require('../src/password');
|
|
|
|
|
var groups = require('../src/groups');
|
|
|
|
|
var helpers = require('./helpers');
|
|
|
|
@ -202,8 +201,8 @@ describe('User', function () {
|
|
|
|
|
|
|
|
|
|
describe('.isReadyToPost()', function () {
|
|
|
|
|
it('should error when a user makes two posts in quick succession', function (done) {
|
|
|
|
|
Meta.config = Meta.config || {};
|
|
|
|
|
Meta.config.postDelay = '10';
|
|
|
|
|
meta.config = meta.config || {};
|
|
|
|
|
meta.config.postDelay = '10';
|
|
|
|
|
|
|
|
|
|
async.series([
|
|
|
|
|
async.apply(Topics.post, {
|
|
|
|
@ -239,8 +238,8 @@ describe('User', function () {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should error when a new user posts if the last post time is 10 < 30 seconds', function (done) {
|
|
|
|
|
Meta.config.newbiePostDelay = 30;
|
|
|
|
|
Meta.config.newbiePostDelayThreshold = 3;
|
|
|
|
|
meta.config.newbiePostDelay = 30;
|
|
|
|
|
meta.config.newbiePostDelayThreshold = 3;
|
|
|
|
|
|
|
|
|
|
User.setUserField(testUid, 'lastposttime', +new Date() - (20 * 1000), function () {
|
|
|
|
|
Topics.post({
|
|
|
|
@ -292,10 +291,10 @@ describe('User', function () {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should error for guest', function (done) {
|
|
|
|
|
Meta.config.allowGuestUserSearching = 0;
|
|
|
|
|
meta.config.allowGuestUserSearching = 0;
|
|
|
|
|
socketUser.search({ uid: 0 }, { query: 'john' }, function (err) {
|
|
|
|
|
assert.equal(err.message, '[[error:not-logged-in]]');
|
|
|
|
|
Meta.config.allowGuestUserSearching = 1;
|
|
|
|
|
meta.config.allowGuestUserSearching = 1;
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
@ -1145,10 +1144,10 @@ describe('User', function () {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should send email confirm', function (done) {
|
|
|
|
|
Meta.config.requireEmailConfirmation = 1;
|
|
|
|
|
meta.config.requireEmailConfirmation = 1;
|
|
|
|
|
socketUser.emailConfirm({ uid: testUid }, {}, function (err) {
|
|
|
|
|
assert.ifError(err);
|
|
|
|
|
Meta.config.requireEmailConfirmation = 0;
|
|
|
|
|
meta.config.requireEmailConfirmation = 0;
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
@ -1258,8 +1257,8 @@ describe('User', function () {
|
|
|
|
|
var oldRegistrationType;
|
|
|
|
|
var adminUid;
|
|
|
|
|
before(function (done) {
|
|
|
|
|
oldRegistrationType = Meta.config.registrationType;
|
|
|
|
|
Meta.config.registrationType = 'admin-approval';
|
|
|
|
|
oldRegistrationType = meta.config.registrationType;
|
|
|
|
|
meta.config.registrationType = 'admin-approval';
|
|
|
|
|
User.create({ username: 'admin', password: '123456' }, function (err, uid) {
|
|
|
|
|
assert.ifError(err);
|
|
|
|
|
adminUid = uid;
|
|
|
|
@ -1268,7 +1267,7 @@ describe('User', function () {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
after(function (done) {
|
|
|
|
|
Meta.config.registrationType = oldRegistrationType;
|
|
|
|
|
meta.config.registrationType = oldRegistrationType;
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|