mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-29 13:52:10 +03:00
deps: grunt-jscs@2.1.0
no issue - update grunt-jscs dependency - fix deprecated `validateJSDoc` configuration - fix numerous linting errors, including: - use of future-reserved `public` and `private` variable names - use of `[]` instead of dot-notation (especially `express['static']` and `cacheRules['x']`) - extra spaces in `const { run } = Ember` style constructs One issue that did become apparent is that there are conflicting rules that prevent the use of object function shorthand such that both of these: ``` { myFunc() {} } { myFunc () {} } ``` are called out due to either the missing or the extra space before the `(`
This commit is contained in:
parent
4acb7b44f3
commit
ff73f1af92
2
.jscsrc
2
.jscsrc
@ -66,7 +66,7 @@
|
||||
"safeContextKeyword": ["self"],
|
||||
"requireDotNotation": true,
|
||||
"disallowYodaConditions": true,
|
||||
"validateJSDoc": {
|
||||
"jsDoc": {
|
||||
"checkParamNames": true,
|
||||
"checkRedundantParams": true,
|
||||
"requireParamTypes": true
|
||||
|
@ -27,7 +27,7 @@ export default EmberSelectizeComponent.extend({
|
||||
* Event callback that is triggered when user creates a tag
|
||||
* - modified to pass the caret position to the action
|
||||
*/
|
||||
_create(input, callback) {
|
||||
_create: function (input, callback) {
|
||||
var caret = this._selectize.caretPos;
|
||||
|
||||
// Delete user entered text
|
||||
@ -43,7 +43,7 @@ export default EmberSelectizeComponent.extend({
|
||||
callback(null);
|
||||
},
|
||||
|
||||
_addSelection(obj) {
|
||||
_addSelection: function (obj) {
|
||||
var _valuePath = this.get('_valuePath'),
|
||||
val = Ember.get(obj, _valuePath),
|
||||
caret = this._selectize.caretPos;
|
||||
|
@ -13,7 +13,7 @@ import initializeTestHelpers from 'simple-auth-testing/test-helpers';
|
||||
|
||||
initializeTestHelpers();
|
||||
|
||||
const { run } = Ember,
|
||||
const {run} = Ember,
|
||||
// TODO: Pull this into a fixture or similar when required elsewhere
|
||||
requiredSettings = [{
|
||||
created_at: '2015-09-11T09:44:30.805Z',
|
||||
|
@ -5,7 +5,7 @@ import hbs from 'htmlbars-inline-precompile';
|
||||
import Ember from 'ember';
|
||||
import { NavItem } from 'ghost/controllers/settings/navigation';
|
||||
|
||||
const { run } = Ember;
|
||||
const {run} = Ember;
|
||||
|
||||
describeComponent(
|
||||
'gh-navigation',
|
||||
|
@ -5,7 +5,7 @@ import hbs from 'htmlbars-inline-precompile';
|
||||
import Ember from 'ember';
|
||||
import { NavItem } from 'ghost/controllers/settings/navigation';
|
||||
|
||||
const { run } = Ember;
|
||||
const {run} = Ember;
|
||||
|
||||
describeComponent(
|
||||
'gh-navitem',
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import Ember from 'ember';
|
||||
|
||||
const { run } = Ember,
|
||||
const {run} = Ember,
|
||||
// we want baseUrl to match the running domain so relative URLs are
|
||||
// handled as expected (browser auto-sets the domain when using a.href)
|
||||
currentUrl = `${window.location.protocol}//${window.location.host}/`;
|
||||
|
@ -4,7 +4,7 @@ import { describeModule, it } from 'ember-mocha';
|
||||
import Ember from 'ember';
|
||||
import { NavItem } from 'ghost/controllers/settings/navigation';
|
||||
|
||||
const { run } = Ember;
|
||||
const {run} = Ember;
|
||||
|
||||
var navSettingJSON = `[
|
||||
{"label":"Home","url":"/"},
|
||||
|
@ -38,8 +38,7 @@ utils = {
|
||||
/**
|
||||
* ### Do Validate
|
||||
* Validate the object and options passed to an endpoint
|
||||
* @argument object
|
||||
* @argument options
|
||||
* @argument {...*} [arguments] object or object and options hash
|
||||
*/
|
||||
return function doValidate() {
|
||||
var object, options, permittedOptions;
|
||||
|
@ -22,7 +22,7 @@ author = function (context, options) {
|
||||
}
|
||||
|
||||
if (options.fn) {
|
||||
return hbs.handlebars.helpers['with'].call(this, this.author, options);
|
||||
return hbs.handlebars.helpers.with.call(this, this.author, options);
|
||||
}
|
||||
|
||||
var autolink = _.isString(options.hash.autolink) && options.hash.autolink === 'false' ? false : true,
|
||||
|
@ -178,7 +178,7 @@ function init(options) {
|
||||
// ##Configuration
|
||||
|
||||
// return the correct mime type for woff files
|
||||
express['static'].mime.define({'application/font-woff': ['woff']});
|
||||
express.static.mime.define({'application/font-woff': ['woff']});
|
||||
|
||||
// enabled gzip compression by default
|
||||
if (config.server.compress !== false) {
|
||||
|
@ -24,7 +24,7 @@ cacheControl = function cacheControl(options) {
|
||||
return function cacheControlHeaders(req, res, next) {
|
||||
if (output) {
|
||||
if (res.isPrivateBlog) {
|
||||
res.set({'Cache-Control': profiles['private']});
|
||||
res.set({'Cache-Control': profiles.private});
|
||||
} else {
|
||||
res.set({'Cache-Control': output});
|
||||
}
|
||||
|
@ -78,9 +78,9 @@ setupMiddleware = function setupMiddleware(blogApp, adminApp) {
|
||||
blogApp.use(serveSharedFile('favicon.ico', 'image/x-icon', utils.ONE_DAY_S));
|
||||
|
||||
// Static assets
|
||||
blogApp.use('/shared', express['static'](path.join(corePath, '/shared'), {maxAge: utils.ONE_HOUR_MS}));
|
||||
blogApp.use('/shared', express.static(path.join(corePath, '/shared'), {maxAge: utils.ONE_HOUR_MS}));
|
||||
blogApp.use('/content/images', storage.getStorage().serve());
|
||||
blogApp.use('/public', express['static'](path.join(corePath, '/built/public'), {maxAge: utils.ONE_YEAR_MS}));
|
||||
blogApp.use('/public', express.static(path.join(corePath, '/built/public'), {maxAge: utils.ONE_YEAR_MS}));
|
||||
|
||||
// First determine whether we're serving admin or theme content
|
||||
blogApp.use(decideIsAdmin);
|
||||
@ -88,7 +88,7 @@ setupMiddleware = function setupMiddleware(blogApp, adminApp) {
|
||||
blogApp.use(themeHandler.configHbsForContext);
|
||||
|
||||
// Admin only config
|
||||
blogApp.use('/ghost', express['static'](config.paths.clientAssets, {maxAge: utils.ONE_YEAR_MS}));
|
||||
blogApp.use('/ghost', express.static(config.paths.clientAssets, {maxAge: utils.ONE_YEAR_MS}));
|
||||
|
||||
// Force SSL
|
||||
// NOTE: Importantly this is _after_ the check above for admin-theme static resources,
|
||||
|
@ -8,7 +8,7 @@ var _ = require('lodash'),
|
||||
errors = require('../errors'),
|
||||
session = require('cookie-session'),
|
||||
utils = require('../utils'),
|
||||
private;
|
||||
privateBlogging;
|
||||
|
||||
function verifySessionHash(salt, hash) {
|
||||
if (!salt || !hash) {
|
||||
@ -24,7 +24,7 @@ function verifySessionHash(salt, hash) {
|
||||
});
|
||||
}
|
||||
|
||||
private = {
|
||||
privateBlogging = {
|
||||
checkIsPrivate: function checkIsPrivate(req, res, next) {
|
||||
return api.settings.read({context: {internal: true}, key: 'isPrivate'}).then(function then(response) {
|
||||
var pass = response.settings[0];
|
||||
@ -64,7 +64,7 @@ private = {
|
||||
res.end(buf);
|
||||
});
|
||||
} else {
|
||||
return private.authenticatePrivateSession(req, res, next);
|
||||
return privateBlogging.authenticatePrivateSession(req, res, next);
|
||||
}
|
||||
},
|
||||
|
||||
@ -133,4 +133,4 @@ private = {
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = private;
|
||||
module.exports = privateBlogging;
|
||||
|
@ -11,7 +11,7 @@ function isBlackListedFileType(file) {
|
||||
}
|
||||
|
||||
function forwardToExpressStatic(req, res, next) {
|
||||
express['static'](
|
||||
express.static(
|
||||
path.join(config.paths.themePath, req.app.get('activeTheme')),
|
||||
{maxAge: utils.ONE_YEAR_MS}
|
||||
)(req, res, next);
|
||||
|
@ -52,7 +52,7 @@ LocalFileStore.prototype.exists = function (filename) {
|
||||
// middleware for serving the files
|
||||
LocalFileStore.prototype.serve = function () {
|
||||
// For some reason send divides the max age number by 1000
|
||||
return express['static'](config.paths.imagesPath, {maxAge: utils.ONE_YEAR_MS});
|
||||
return express.static(config.paths.imagesPath, {maxAge: utils.ONE_YEAR_MS});
|
||||
};
|
||||
|
||||
module.exports = LocalFileStore;
|
||||
|
@ -291,7 +291,7 @@ casper.on('error', function (msg, trace) {
|
||||
if (trace && trace[0]) {
|
||||
casper.echoConcise('file: ' + trace[0].file, 'WARNING');
|
||||
casper.echoConcise('line: ' + trace[0].line, 'WARNING');
|
||||
casper.echoConcise('function: ' + trace[0]['function'], 'WARNING');
|
||||
casper.echoConcise('function: ' + trace[0].function, 'WARNING');
|
||||
}
|
||||
jsErrors.push(msg);
|
||||
});
|
||||
@ -302,7 +302,7 @@ casper.on('page.error', function (msg, trace) {
|
||||
if (trace && trace[0]) {
|
||||
casper.echoConcise('file: ' + trace[0].file, 'WARNING');
|
||||
casper.echoConcise('line: ' + trace[0].line, 'WARNING');
|
||||
casper.echoConcise('function: ' + trace[0]['function'], 'WARNING');
|
||||
casper.echoConcise('function: ' + trace[0].function, 'WARNING');
|
||||
}
|
||||
pageErrors.push(msg);
|
||||
});
|
||||
|
@ -188,7 +188,7 @@ describe('Admin Routing', function () {
|
||||
it('should redirect from /ghost/ to /ghost/setup/ when no user/not installed yet', function (done) {
|
||||
request.get('/ghost/')
|
||||
.expect('Location', /ghost\/setup/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -196,7 +196,7 @@ describe('Admin Routing', function () {
|
||||
it('should redirect from /ghost/signin/ to /ghost/setup/ when no user', function (done) {
|
||||
request.get('/ghost/signin/')
|
||||
.expect('Location', /ghost\/setup/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -204,7 +204,7 @@ describe('Admin Routing', function () {
|
||||
it('should respond with html for /ghost/setup/', function (done) {
|
||||
request.get('/ghost/setup/')
|
||||
.expect('Content-Type', /html/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
|
@ -54,7 +54,7 @@ describe('Authentication API', function () {
|
||||
request.post(testUtils.API.getApiQuery('authentication/token'))
|
||||
.send({grant_type: 'password', username: 'invalid@email.com', password: user.password, client_id: 'ghost-admin', client_secret: 'not_available'})
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -71,7 +71,7 @@ describe('Authentication API', function () {
|
||||
request.post(testUtils.API.getApiQuery('authentication/token'))
|
||||
.send({grant_type: 'password', username: user.email, password: 'invalid', client_id: 'ghost-admin', client_secret: 'not_available'})
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(401)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -118,7 +118,7 @@ describe('Authentication API', function () {
|
||||
request.post(testUtils.API.getApiQuery('authentication/token'))
|
||||
.send({grant_type: 'refresh_token', refresh_token: 'invalid', client_id: 'ghost-admin', client_secret: 'not_available'})
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(403)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
|
@ -32,7 +32,7 @@ describe('DB API', function () {
|
||||
request.get(testUtils.API.getApiQuery('db/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.expect('Content-Disposition', /Attachment; filename="[A-Za-z0-9._-]+\.json"/)
|
||||
.end(function (err, res) {
|
||||
|
@ -30,7 +30,7 @@ describe('Unauthorized', function () {
|
||||
describe('Unauthorized API', function () {
|
||||
it('can\'t retrieve posts', function (done) {
|
||||
request.get(testUtils.API.getApiQuery('posts/'))
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(401)
|
||||
.end(function firstRequest(err, res) {
|
||||
if (err) {
|
||||
|
@ -40,7 +40,7 @@ describe('Notifications API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send({notifications: [newNotification]})
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(201)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -75,7 +75,7 @@ describe('Notifications API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send({notifications: [newNotification]})
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(201)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
|
@ -36,7 +36,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -60,7 +60,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/?staticPages=all'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -84,7 +84,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/?staticPages=all&status=all'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -106,7 +106,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/?staticPages=true'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -128,7 +128,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/?featured=true'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -150,7 +150,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/?status=draft'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -175,7 +175,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/1/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -204,7 +204,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/slug/welcome-to-ghost/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -232,7 +232,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/1/?include=author,tags,created_by'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -258,7 +258,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/3/?include=next,previous'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -284,7 +284,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/7/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -306,7 +306,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/99/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -326,7 +326,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/5/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -346,7 +346,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/8/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -376,7 +376,7 @@ describe('Post API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send(newPost)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(201)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -400,7 +400,7 @@ describe('Post API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send(draftPost)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -427,7 +427,7 @@ describe('Post API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send(publishedPost)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -464,7 +464,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/1/?include=tags'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -481,7 +481,7 @@ describe('Post API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send(jsonResponse)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -510,7 +510,7 @@ describe('Post API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send(newPost)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(201)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -530,7 +530,7 @@ describe('Post API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send(draftPost)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -555,7 +555,7 @@ describe('Post API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send(newPost)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(201)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -576,7 +576,7 @@ describe('Post API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send(draftPost)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -594,7 +594,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/1/?include=tags'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -610,7 +610,7 @@ describe('Post API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send(jsonResponse)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -632,7 +632,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/7/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -648,7 +648,7 @@ describe('Post API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send(jsonResponse)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -670,7 +670,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/7/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -686,7 +686,7 @@ describe('Post API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send(jsonResponse)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(422)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -706,7 +706,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/1/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.end(function (err, res) {
|
||||
/*jshint unused:false*/
|
||||
if (err) {
|
||||
@ -718,7 +718,7 @@ describe('Post API', function () {
|
||||
.set('Authorization', 'Bearer ' + 'invalidtoken')
|
||||
.send(jsonResponse)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(401)
|
||||
.end(function (err, res) {
|
||||
/*jshint unused:false*/
|
||||
@ -735,7 +735,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/1/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -748,7 +748,7 @@ describe('Post API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send(jsonResponse)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(400)
|
||||
.end(function (err, res) {
|
||||
/*jshint unused:false*/
|
||||
@ -765,7 +765,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/1/?include=tags'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -781,7 +781,7 @@ describe('Post API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send(jsonResponse)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -807,7 +807,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/1/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -822,7 +822,7 @@ describe('Post API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send(jsonResponse)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -846,7 +846,7 @@ describe('Post API', function () {
|
||||
request.del(testUtils.API.getApiQuery('posts/' + deletePostId + '/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -867,7 +867,7 @@ describe('Post API', function () {
|
||||
request.del(testUtils.API.getApiQuery('posts/99/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -892,7 +892,7 @@ describe('Post API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send(newPost)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(201)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -909,7 +909,7 @@ describe('Post API', function () {
|
||||
request.del(testUtils.API.getApiQuery('posts/' + draftPost.posts[0].id + '/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -931,7 +931,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('settings/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -944,7 +944,7 @@ describe('Post API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send(jsonResponse)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.end(function (err, res) {
|
||||
/*jshint unused:false*/
|
||||
if (err) {
|
||||
@ -959,7 +959,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('settings/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -971,7 +971,7 @@ describe('Post API', function () {
|
||||
request.put(testUtils.API.getApiQuery('settings/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.send(jsonResponse)
|
||||
.end(function (err, res) {
|
||||
/*jshint unused:false*/
|
||||
@ -989,7 +989,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/2/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -1012,7 +1012,7 @@ describe('Post API', function () {
|
||||
request.get(testUtils.API.getApiQuery('posts/2/?include=tags'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -1027,7 +1027,7 @@ describe('Post API', function () {
|
||||
request.put(testUtils.API.getApiQuery('posts/2/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.send(jsonResponse)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
|
@ -35,7 +35,7 @@ describe('Settings API', function () {
|
||||
request.get(testUtils.API.getApiQuery('settings/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -55,7 +55,7 @@ describe('Settings API', function () {
|
||||
request.get(testUtils.API.getApiQuery('settings/title/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -79,7 +79,7 @@ describe('Settings API', function () {
|
||||
request.get(testUtils.API.getApiQuery('settings/testsetting/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -99,7 +99,7 @@ describe('Settings API', function () {
|
||||
request.get(testUtils.API.getApiQuery('settings/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -120,7 +120,7 @@ describe('Settings API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send(settingToChange)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -141,7 +141,7 @@ describe('Settings API', function () {
|
||||
request.get(testUtils.API.getApiQuery('settings/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -171,7 +171,7 @@ describe('Settings API', function () {
|
||||
request.get(testUtils.API.getApiQuery('settings/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -187,7 +187,7 @@ describe('Settings API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send(jsonResponse)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
|
@ -34,7 +34,7 @@ describe('Slug API', function () {
|
||||
request.get(testUtils.API.getApiQuery('slugs/post/a post title/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -57,7 +57,7 @@ describe('Slug API', function () {
|
||||
request.get(testUtils.API.getApiQuery('slugs/post/atag/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -80,7 +80,7 @@ describe('Slug API', function () {
|
||||
request.get(testUtils.API.getApiQuery('slugs/user/user name/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -103,7 +103,7 @@ describe('Slug API', function () {
|
||||
request.get(testUtils.API.getApiQuery('slugs/app/cool app/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -126,7 +126,7 @@ describe('Slug API', function () {
|
||||
request.get(testUtils.API.getApiQuery('slugs/unknown/who knows/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(400)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
|
@ -34,7 +34,7 @@ describe('Tag API', function () {
|
||||
request.get(testUtils.API.getApiQuery('tags/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
|
@ -35,7 +35,7 @@ describe('User API', function () {
|
||||
request.get(testUtils.API.getApiQuery('users/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -61,7 +61,7 @@ describe('User API', function () {
|
||||
request.get(testUtils.API.getApiQuery('users/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -83,7 +83,7 @@ describe('User API', function () {
|
||||
request.get(testUtils.API.getApiQuery('users/?include=roles'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -107,7 +107,7 @@ describe('User API', function () {
|
||||
request.get(testUtils.API.getApiQuery('users/me/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -129,7 +129,7 @@ describe('User API', function () {
|
||||
request.get(testUtils.API.getApiQuery('users/1/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -151,7 +151,7 @@ describe('User API', function () {
|
||||
request.get(testUtils.API.getApiQuery('users/slug/joe-bloggs/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -173,7 +173,7 @@ describe('User API', function () {
|
||||
request.get(testUtils.API.getApiQuery('users/email/jbloggs%40example.com/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -195,7 +195,7 @@ describe('User API', function () {
|
||||
request.get(testUtils.API.getApiQuery('users/me/?include=roles'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -218,7 +218,7 @@ describe('User API', function () {
|
||||
request.get(testUtils.API.getApiQuery('users/me/?include=roles,roles.permissions'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -243,7 +243,7 @@ describe('User API', function () {
|
||||
request.get(testUtils.API.getApiQuery('users/slug/joe-bloggs/?include=roles,roles.permissions'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -268,7 +268,7 @@ describe('User API', function () {
|
||||
request.get(testUtils.API.getApiQuery('users/99/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -288,7 +288,7 @@ describe('User API', function () {
|
||||
request.get(testUtils.API.getApiQuery('users/slug/blargh/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -309,7 +309,7 @@ describe('User API', function () {
|
||||
request.get(testUtils.API.getApiQuery('users/me/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -329,7 +329,7 @@ describe('User API', function () {
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.send(dataToSend)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -351,7 +351,7 @@ describe('User API', function () {
|
||||
request.get(testUtils.API.getApiQuery('users/me/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
|
@ -57,7 +57,7 @@ describe('Frontend Routing', function () {
|
||||
describe('Error', function () {
|
||||
it('should 404 for unknown post', function (done) {
|
||||
request.get('/spectacular/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.expect(/Page not found/)
|
||||
.end(doEnd(done));
|
||||
@ -65,7 +65,7 @@ describe('Frontend Routing', function () {
|
||||
|
||||
it('should 404 for unknown post with invalid characters', function (done) {
|
||||
request.get('/$pec+acular~/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.expect(/Page not found/)
|
||||
.end(doEnd(done));
|
||||
@ -73,7 +73,7 @@ describe('Frontend Routing', function () {
|
||||
|
||||
it('should 404 for unknown frontend route', function (done) {
|
||||
request.get('/spectacular/marvellous/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.expect(/Page not found/)
|
||||
.end(doEnd(done));
|
||||
@ -81,7 +81,7 @@ describe('Frontend Routing', function () {
|
||||
|
||||
it('should 404 for unknown tag', function (done) {
|
||||
request.get('/tag/spectacular/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.expect(/Page not found/)
|
||||
.end(doEnd(done));
|
||||
@ -89,7 +89,7 @@ describe('Frontend Routing', function () {
|
||||
|
||||
it('should 404 for unknown tag with invalid characters', function (done) {
|
||||
request.get('/tag/~$pectacular~/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.expect(/Page not found/)
|
||||
.end(doEnd(done));
|
||||
@ -97,7 +97,7 @@ describe('Frontend Routing', function () {
|
||||
|
||||
it('should 404 for unknown author', function (done) {
|
||||
request.get('/author/spectacular/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.expect(/Page not found/)
|
||||
.end(doEnd(done));
|
||||
@ -105,7 +105,7 @@ describe('Frontend Routing', function () {
|
||||
|
||||
it('should 404 for encoded char not 301 from uncapitalise', function (done) {
|
||||
request.get('/|/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.expect(/Page not found/)
|
||||
.end(doEnd(done));
|
||||
@ -113,7 +113,7 @@ describe('Frontend Routing', function () {
|
||||
|
||||
it('should 404 for unknown author with invalid characters', function (done) {
|
||||
request.get('/author/ghost!user^/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.expect(/Page not found/)
|
||||
.end(doEnd(done));
|
||||
@ -124,7 +124,7 @@ describe('Frontend Routing', function () {
|
||||
it('should respond with html', function (done) {
|
||||
request.get('/')
|
||||
.expect('Content-Type', /html/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -152,7 +152,7 @@ describe('Frontend Routing', function () {
|
||||
it('should not have as second page', function (done) {
|
||||
request.get('/page/2/')
|
||||
.expect('Location', '/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -178,7 +178,7 @@ describe('Frontend Routing', function () {
|
||||
it('should respond with html for valid url', function (done) {
|
||||
request.get('/welcome-to-ghost/')
|
||||
.expect('Content-Type', /html/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -209,7 +209,7 @@ describe('Frontend Routing', function () {
|
||||
var date = moment().format('YYYY/MM/DD');
|
||||
|
||||
request.get('/' + date + '/welcome-to-ghost/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.expect(/Page not found/)
|
||||
.end(doEnd(done));
|
||||
@ -228,14 +228,14 @@ describe('Frontend Routing', function () {
|
||||
it('should redirect to editor', function (done) {
|
||||
request.get('/welcome-to-ghost/edit/')
|
||||
.expect('Location', '/ghost/editor/1/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
|
||||
it('should 404 for non-edit parameter', function (done) {
|
||||
request.get('/welcome-to-ghost/notedit/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.expect(/Page not found/)
|
||||
.end(doEnd(done));
|
||||
@ -305,7 +305,7 @@ describe('Frontend Routing', function () {
|
||||
it('should respond with xml', function (done) {
|
||||
request.get('/static-page-test/')
|
||||
.expect('Content-Type', /html/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(200)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -366,7 +366,7 @@ describe('Frontend Routing', function () {
|
||||
// Badly formed regexs can cause breakage if a post slug starts with the 5 letters ghost
|
||||
it('should retrieve a blog post with ghost at the start of the url', function (done) {
|
||||
request.get('/ghostly-kitchen-sink/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(200)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -399,7 +399,7 @@ describe('Frontend Routing', function () {
|
||||
it('should respond with html', function (done) {
|
||||
request.get('/page/2/')
|
||||
.expect('Content-Type', /html/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(200)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -407,7 +407,7 @@ describe('Frontend Routing', function () {
|
||||
it('should redirect page 1', function (done) {
|
||||
request.get('/page/1/')
|
||||
.expect('Location', '/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
// TODO: This should probably be a 301?
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
@ -416,7 +416,7 @@ describe('Frontend Routing', function () {
|
||||
it('should redirect to last page if page too high', function (done) {
|
||||
request.get('/page/4/')
|
||||
.expect('Location', '/page/3/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -424,7 +424,7 @@ describe('Frontend Routing', function () {
|
||||
it('should redirect to first page if page too low', function (done) {
|
||||
request.get('/page/0/')
|
||||
.expect('Location', '/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -457,7 +457,7 @@ describe('Frontend Routing', function () {
|
||||
it('should respond with 200 & CC=public', function (done) {
|
||||
request.get('/rss/')
|
||||
.expect('Content-Type', 'text/xml; charset=utf-8')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -502,7 +502,7 @@ describe('Frontend Routing', function () {
|
||||
it('should respond with xml', function (done) {
|
||||
request.get('/rss/2/')
|
||||
.expect('Content-Type', /xml/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(200)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -528,7 +528,7 @@ describe('Frontend Routing', function () {
|
||||
|
||||
it('should 404 for /author/ route', function (done) {
|
||||
request.get('/author/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.expect(/Page not found/)
|
||||
.end(doEnd(done));
|
||||
@ -545,7 +545,7 @@ describe('Frontend Routing', function () {
|
||||
it('should respond with html', function (done) {
|
||||
request.get('/author/ghost-owner/page/2/')
|
||||
.expect('Content-Type', /html/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(200)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -553,7 +553,7 @@ describe('Frontend Routing', function () {
|
||||
it('should redirect page 1', function (done) {
|
||||
request.get('/author/ghost-owner/page/1/')
|
||||
.expect('Location', '/author/ghost-owner/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
// TODO: This should probably be a 301?
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
@ -562,7 +562,7 @@ describe('Frontend Routing', function () {
|
||||
it('should redirect to last page if page too high', function (done) {
|
||||
request.get('/author/ghost-owner/page/4/')
|
||||
.expect('Location', '/author/ghost-owner/page/3/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -570,7 +570,7 @@ describe('Frontend Routing', function () {
|
||||
it('should redirect to first page if page too low', function (done) {
|
||||
request.get('/author/ghost-owner/page/0/')
|
||||
.expect('Location', '/author/ghost-owner/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -587,7 +587,7 @@ describe('Frontend Routing', function () {
|
||||
it('should respond with xml', function (done) {
|
||||
request.get('/author/ghost-owner/rss/')
|
||||
.expect('Content-Type', /xml/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(200)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -595,7 +595,7 @@ describe('Frontend Routing', function () {
|
||||
it('should redirect page 1', function (done) {
|
||||
request.get('/author/ghost-owner/rss/1/')
|
||||
.expect('Location', '/author/ghost-owner/rss/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
// TODO: This should probably be a 301?
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
@ -604,7 +604,7 @@ describe('Frontend Routing', function () {
|
||||
it('should redirect to last page if page too high', function (done) {
|
||||
request.get('/author/ghost-owner/rss/2/')
|
||||
.expect('Location', '/author/ghost-owner/rss/1/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -612,7 +612,7 @@ describe('Frontend Routing', function () {
|
||||
it('should redirect to first page if page too low', function (done) {
|
||||
request.get('/author/ghost-owner/rss/0/')
|
||||
.expect('Location', '/author/ghost-owner/rss/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -630,14 +630,14 @@ describe('Frontend Routing', function () {
|
||||
it('should redirect to editor', function (done) {
|
||||
request.get('/author/ghost-owner/edit/')
|
||||
.expect('Location', '/ghost/team/ghost-owner/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
|
||||
it('should 404 for something that isn\'t edit', function (done) {
|
||||
request.get('/author/ghost-owner/notedit/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.expect(/Page not found/)
|
||||
.end(doEnd(done));
|
||||
@ -663,7 +663,7 @@ describe('Frontend Routing', function () {
|
||||
|
||||
it('should 404 for /tag/ route', function (done) {
|
||||
request.get('/tag/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['private'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.expect(/Page not found/)
|
||||
.end(doEnd(done));
|
||||
@ -680,7 +680,7 @@ describe('Frontend Routing', function () {
|
||||
it('should respond with html', function (done) {
|
||||
request.get('/tag/injection/page/2/')
|
||||
.expect('Content-Type', /html/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(200)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -688,7 +688,7 @@ describe('Frontend Routing', function () {
|
||||
it('should redirect page 1', function (done) {
|
||||
request.get('/tag/injection/page/1/')
|
||||
.expect('Location', '/tag/injection/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
// TODO: This should probably be a 301?
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
@ -697,7 +697,7 @@ describe('Frontend Routing', function () {
|
||||
it('should redirect to last page if page too high', function (done) {
|
||||
request.get('/tag/injection/page/4/')
|
||||
.expect('Location', '/tag/injection/page/3/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -705,7 +705,7 @@ describe('Frontend Routing', function () {
|
||||
it('should redirect to first page if page too low', function (done) {
|
||||
request.get('/tag/injection/page/0/')
|
||||
.expect('Location', '/tag/injection/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -722,7 +722,7 @@ describe('Frontend Routing', function () {
|
||||
it('should respond with xml', function (done) {
|
||||
request.get('/tag/getting-started/rss/')
|
||||
.expect('Content-Type', /xml/)
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(200)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -730,7 +730,7 @@ describe('Frontend Routing', function () {
|
||||
it('should redirect page 1', function (done) {
|
||||
request.get('/tag/getting-started/rss/1/')
|
||||
.expect('Location', '/tag/getting-started/rss/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
// TODO: This should probably be a 301?
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
@ -739,7 +739,7 @@ describe('Frontend Routing', function () {
|
||||
it('should redirect to last page if page too high', function (done) {
|
||||
request.get('/tag/getting-started/rss/2/')
|
||||
.expect('Location', '/tag/getting-started/rss/1/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -747,7 +747,7 @@ describe('Frontend Routing', function () {
|
||||
it('should redirect to first page if page too low', function (done) {
|
||||
request.get('/tag/getting-started/rss/0/')
|
||||
.expect('Location', '/tag/getting-started/rss/')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
@ -978,7 +978,7 @@ describe('Frontend Routing', function () {
|
||||
it('should serve RSS with date permalink', function (done) {
|
||||
request.get('/rss/')
|
||||
.expect('Content-Type', 'text/xml; charset=utf-8')
|
||||
.expect('Cache-Control', testUtils.cacheRules['public'])
|
||||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
|
@ -26,7 +26,7 @@ describe('Error handling', function () {
|
||||
errors.throwError(toThrow);
|
||||
};
|
||||
|
||||
runThrowError.should['throw']('test1');
|
||||
runThrowError.should.throw('test1');
|
||||
});
|
||||
|
||||
it('throws error strings', function () {
|
||||
@ -35,7 +35,7 @@ describe('Error handling', function () {
|
||||
errors.throwError(toThrow);
|
||||
};
|
||||
|
||||
runThrowError.should['throw']('test2');
|
||||
runThrowError.should.throw('test2');
|
||||
});
|
||||
|
||||
it('throws error even if nothing passed', function () {
|
||||
@ -43,7 +43,7 @@ describe('Error handling', function () {
|
||||
errors.throwError();
|
||||
};
|
||||
|
||||
runThrowError.should['throw']('An error occurred');
|
||||
runThrowError.should.throw('An error occurred');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -50,25 +50,25 @@ describe('Middleware: cacheControl', function () {
|
||||
});
|
||||
|
||||
it('will not get confused between serving public and private', function (done) {
|
||||
var public = middleware.cacheControl('public'),
|
||||
private = middleware.cacheControl('private');
|
||||
var publicCC = middleware.cacheControl('public'),
|
||||
privateCC = middleware.cacheControl('private');
|
||||
|
||||
public(null, res, function () {
|
||||
publicCC(null, res, function () {
|
||||
res.set.calledOnce.should.be.true;
|
||||
res.set.calledWith({'Cache-Control': 'public, max-age=0'});
|
||||
|
||||
private(null, res, function () {
|
||||
privateCC(null, res, function () {
|
||||
res.set.calledTwice.should.be.true;
|
||||
res.set.calledWith({
|
||||
'Cache-Control':
|
||||
'no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0'
|
||||
});
|
||||
|
||||
public(null, res, function () {
|
||||
publicCC(null, res, function () {
|
||||
res.set.calledThrice.should.be.true;
|
||||
res.set.calledWith({'Cache-Control': 'public, max-age=0'});
|
||||
|
||||
private(null, res, function () {
|
||||
privateCC(null, res, function () {
|
||||
res.set.calledWith({
|
||||
'Cache-Control': 'no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0'
|
||||
});
|
||||
|
@ -142,16 +142,16 @@ describe('Permissions', function () {
|
||||
});
|
||||
|
||||
it('should return unchanged object for post with public context', function (done) {
|
||||
var public = {context: {}};
|
||||
var publicContext = {context: {}};
|
||||
|
||||
permissions.applyPublicRules('posts', 'browse', _.cloneDeep(public)).then(function (result) {
|
||||
result.should.not.eql(public);
|
||||
permissions.applyPublicRules('posts', 'browse', _.cloneDeep(publicContext)).then(function (result) {
|
||||
result.should.not.eql(publicContext);
|
||||
result.should.eql({
|
||||
context: {},
|
||||
status: 'published'
|
||||
});
|
||||
|
||||
return permissions.applyPublicRules('posts', 'browse', _.extend({}, _.cloneDeep(public), {status: 'published'}));
|
||||
return permissions.applyPublicRules('posts', 'browse', _.extend({}, _.cloneDeep(publicContext), {status: 'published'}));
|
||||
}).then(function (result) {
|
||||
result.should.eql({
|
||||
context: {},
|
||||
@ -243,16 +243,16 @@ describe('Permissions', function () {
|
||||
});
|
||||
|
||||
it('should return unchanged object for user with public context', function (done) {
|
||||
var public = {context: {}};
|
||||
var publicContext = {context: {}};
|
||||
|
||||
permissions.applyPublicRules('users', 'browse', _.cloneDeep(public)).then(function (result) {
|
||||
result.should.not.eql(public);
|
||||
permissions.applyPublicRules('users', 'browse', _.cloneDeep(publicContext)).then(function (result) {
|
||||
result.should.not.eql(publicContext);
|
||||
result.should.eql({
|
||||
context: {},
|
||||
status: 'active'
|
||||
});
|
||||
|
||||
return permissions.applyPublicRules('users', 'browse', _.extend({}, _.cloneDeep(public), {status: 'active'}));
|
||||
return permissions.applyPublicRules('users', 'browse', _.extend({}, _.cloneDeep(publicContext), {status: 'active'}));
|
||||
}).then(function (result) {
|
||||
result.should.eql({
|
||||
context: {},
|
||||
|
@ -82,7 +82,7 @@
|
||||
"grunt-contrib-watch": "0.6.1",
|
||||
"grunt-docker": "0.0.10",
|
||||
"grunt-express-server": "0.5.1",
|
||||
"grunt-jscs": "1.8.0",
|
||||
"grunt-jscs": "2.1.0",
|
||||
"grunt-mocha-cli": "1.13.0",
|
||||
"grunt-mocha-istanbul": "2.4.0",
|
||||
"grunt-shell": "1.1.2",
|
||||
|
Loading…
Reference in New Issue
Block a user