Update tests for strong-error-handler
Fix rest-adapter related test case switching to strong-error-handler Only affect the test-cases calling rest methods
This commit is contained in:
parent
276fb5bf69
commit
ddb5327e64
|
@ -503,6 +503,7 @@ function createTestApp(testToken, settings, done) {
|
||||||
|
|
||||||
app.use(cookieParser('secret'));
|
app.use(cookieParser('secret'));
|
||||||
app.use(loopback.token(tokenSettings));
|
app.use(loopback.token(tokenSettings));
|
||||||
|
app.set('remoting', { errorHandler: { debug: true, log: false }});
|
||||||
app.get('/token', function(req, res) {
|
app.get('/token', function(req, res) {
|
||||||
res.cookie('authorization', testToken.id, { signed: true });
|
res.cookie('authorization', testToken.id, { signed: true });
|
||||||
res.cookie('access_token', testToken.id, { signed: true });
|
res.cookie('access_token', testToken.id, { signed: true });
|
||||||
|
|
|
@ -396,6 +396,7 @@ describe('access check', function() {
|
||||||
var app;
|
var app;
|
||||||
before(function() {
|
before(function() {
|
||||||
app = loopback();
|
app = loopback();
|
||||||
|
app.set('remoting', { errorHandler: { debug: true, log: false }});
|
||||||
app.use(loopback.rest());
|
app.use(loopback.rest());
|
||||||
app.enableAuth();
|
app.enableAuth();
|
||||||
app.dataSource('test', { connector: 'memory' });
|
app.dataSource('test', { connector: 'memory' });
|
||||||
|
|
|
@ -613,6 +613,7 @@ describe('app', function() {
|
||||||
var app, db;
|
var app, db;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
app = loopback();
|
app = loopback();
|
||||||
|
app.set('remoting', { errorHandler: { debug: true, log: false }});
|
||||||
db = loopback.createDataSource({ connector: loopback.Memory });
|
db = loopback.createDataSource({ connector: loopback.Memory });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
{
|
{
|
||||||
"port": 3000,
|
"port": 3000,
|
||||||
"host": "0.0.0.0",
|
"host": "0.0.0.0",
|
||||||
"legacyExplorer": false
|
"legacyExplorer": false,
|
||||||
|
"remoting": {
|
||||||
|
"errorHandler": {
|
||||||
|
"debug": true,
|
||||||
|
"log": false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -20,7 +20,8 @@
|
||||||
},
|
},
|
||||||
"cors": false,
|
"cors": false,
|
||||||
"errorHandler": {
|
"errorHandler": {
|
||||||
"disableStackTrace": false
|
"debug": true,
|
||||||
|
"log": false
|
||||||
},
|
},
|
||||||
"sharedMethods": {
|
"sharedMethods": {
|
||||||
"*": false,
|
"*": false,
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
},
|
},
|
||||||
"cors": false,
|
"cors": false,
|
||||||
"errorHandler": {
|
"errorHandler": {
|
||||||
"disableStackTrace": false
|
"debug": true,
|
||||||
|
"log": false
|
||||||
},
|
},
|
||||||
"sharedMethods": {
|
"sharedMethods": {
|
||||||
"*": false
|
"*": false
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
},
|
},
|
||||||
"cors": false,
|
"cors": false,
|
||||||
"errorHandler": {
|
"errorHandler": {
|
||||||
"disableStackTrace": false
|
"debug": true,
|
||||||
|
"log": false
|
||||||
},
|
},
|
||||||
"sharedMethods": {
|
"sharedMethods": {
|
||||||
"*": true
|
"*": true
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
},
|
},
|
||||||
"cors": false,
|
"cors": false,
|
||||||
"errorHandler": {
|
"errorHandler": {
|
||||||
"disableStackTrace": false
|
"debug": true,
|
||||||
|
"log": false
|
||||||
},
|
},
|
||||||
"sharedMethods": {
|
"sharedMethods": {
|
||||||
"find": false
|
"find": false
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
},
|
},
|
||||||
"cors": false,
|
"cors": false,
|
||||||
"errorHandler": {
|
"errorHandler": {
|
||||||
"disableStackTrace": false
|
"debug": true,
|
||||||
|
"log": false
|
||||||
},
|
},
|
||||||
"sharedMethods": {
|
"sharedMethods": {
|
||||||
"find": true
|
"find": true
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
},
|
},
|
||||||
"cors": false,
|
"cors": false,
|
||||||
"errorHandler": {
|
"errorHandler": {
|
||||||
"disableStackTrace": false
|
"debug": true,
|
||||||
|
"log": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"legacyExplorer": false
|
"legacyExplorer": false
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
},
|
},
|
||||||
"cors": false,
|
"cors": false,
|
||||||
"errorHandler": {
|
"errorHandler": {
|
||||||
"disableStackTrace": false
|
"debug": true,
|
||||||
|
"log": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"legacyExplorer": false
|
"legacyExplorer": false
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
},
|
},
|
||||||
"cors": false,
|
"cors": false,
|
||||||
"errorHandler": {
|
"errorHandler": {
|
||||||
"disableStackTrace": false
|
"debug": true,
|
||||||
|
"log": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"legacyExplorer": false
|
"legacyExplorer": false
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
},
|
},
|
||||||
"cors": false,
|
"cors": false,
|
||||||
"errorHandler": {
|
"errorHandler": {
|
||||||
"disableStackTrace": false
|
"debug": true,
|
||||||
|
"log": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"legacyExplorer": false
|
"legacyExplorer": false
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
{
|
{
|
||||||
"port": 3000,
|
"port": 3000,
|
||||||
"host": "127.0.0.1",
|
"host": "127.0.0.1",
|
||||||
"legacyExplorer": false
|
"legacyExplorer": false,
|
||||||
|
"remoting": {
|
||||||
|
"errorHandler": {
|
||||||
|
"debug": true,
|
||||||
|
"log": false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,10 @@
|
||||||
},
|
},
|
||||||
"urlencoded": {
|
"urlencoded": {
|
||||||
"limit": "8kb"
|
"limit": "8kb"
|
||||||
|
},
|
||||||
|
"errorHandler": {
|
||||||
|
"debug": true,
|
||||||
|
"log": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"legacyExplorer": false
|
"legacyExplorer": false
|
||||||
|
|
|
@ -9,6 +9,10 @@
|
||||||
},
|
},
|
||||||
"urlencoded": {
|
"urlencoded": {
|
||||||
"limit": "8kb"
|
"limit": "8kb"
|
||||||
|
},
|
||||||
|
"errorHandler": {
|
||||||
|
"debug": true,
|
||||||
|
"log": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"legacyExplorer": false
|
"legacyExplorer": false
|
||||||
|
|
|
@ -67,6 +67,8 @@ _beforeEach.givenModel = function(modelName, attrs, optionalHandler) {
|
||||||
var test = this;
|
var test = this;
|
||||||
var app = this.app;
|
var app = this.app;
|
||||||
var model = app.models[modelName];
|
var model = app.models[modelName];
|
||||||
|
|
||||||
|
app.set('remoting', { errorHandler: { debug: true, log: false }});
|
||||||
assert(model, 'cannot get model of name ' + modelName + ' from app.models');
|
assert(model, 'cannot get model of name ' + modelName + ' from app.models');
|
||||||
assert(model.dataSource, 'cannot test model ' + modelName +
|
assert(model.dataSource, 'cannot test model ' + modelName +
|
||||||
' without attached dataSource');
|
' without attached dataSource');
|
||||||
|
|
|
@ -125,6 +125,7 @@ describe.onServer('Remote Methods', function() {
|
||||||
);
|
);
|
||||||
|
|
||||||
app = loopback();
|
app = loopback();
|
||||||
|
app.set('remoting', { errorHandler: { debug: true, log: false }});
|
||||||
app.use(loopback.rest());
|
app.use(loopback.rest());
|
||||||
app.model(User);
|
app.model(User);
|
||||||
});
|
});
|
||||||
|
|
|
@ -263,7 +263,7 @@ describe('relations - integration', function() {
|
||||||
lt.describe.whenCalledRemotely('GET', '/stores/:id/widgets/:fk', function() {
|
lt.describe.whenCalledRemotely('GET', '/stores/:id/widgets/:fk', function() {
|
||||||
it('should fail with statusCode 404', function() {
|
it('should fail with statusCode 404', function() {
|
||||||
assert.equal(this.res.statusCode, 404);
|
assert.equal(this.res.statusCode, 404);
|
||||||
assert.equal(this.res.body.error.status, 404);
|
assert.equal(this.res.body.error.statusCode, 404);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1652,7 +1652,7 @@ describe('relations - integration', function() {
|
||||||
expect(res.body).to.be.an('object');
|
expect(res.body).to.be.an('object');
|
||||||
expect(res.body.error).to.be.an('object');
|
expect(res.body.error).to.be.an('object');
|
||||||
expect(res.body.error.name).to.equal('Error');
|
expect(res.body.error.name).to.equal('Error');
|
||||||
expect(res.body.error.status).to.equal(500);
|
expect(res.body.error.statusCode).to.equal(500);
|
||||||
expect(res.body.error.message).to.equal('This should not crash the app');
|
expect(res.body.error.message).to.equal('This should not crash the app');
|
||||||
|
|
||||||
done();
|
done();
|
||||||
|
|
|
@ -13,6 +13,7 @@ describe('RemoteConnector', function() {
|
||||||
beforeEach: function(done) {
|
beforeEach: function(done) {
|
||||||
var test = this;
|
var test = this;
|
||||||
remoteApp = loopback();
|
remoteApp = loopback();
|
||||||
|
remoteApp.set('remoting', { errorHandler: { debug: true, log: false }});
|
||||||
remoteApp.use(loopback.rest());
|
remoteApp.use(loopback.rest());
|
||||||
remoteApp.listen(0, function() {
|
remoteApp.listen(0, function() {
|
||||||
test.dataSource = loopback.createDataSource({
|
test.dataSource = loopback.createDataSource({
|
||||||
|
|
|
@ -22,7 +22,8 @@ describe('remoting - integration', function() {
|
||||||
it('should load remoting options', function() {
|
it('should load remoting options', function() {
|
||||||
var remotes = app.remotes();
|
var remotes = app.remotes();
|
||||||
assert.deepEqual(remotes.options, { 'json': { 'limit': '1kb', 'strict': false },
|
assert.deepEqual(remotes.options, { 'json': { 'limit': '1kb', 'strict': false },
|
||||||
'urlencoded': { 'limit': '8kb', 'extended': true }});
|
'urlencoded': { 'limit': '8kb', 'extended': true },
|
||||||
|
'errorHandler': { 'debug': true, log: false }});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('rest handler', function() {
|
it('rest handler', function() {
|
||||||
|
|
|
@ -462,6 +462,7 @@ describe('Replication over REST', function() {
|
||||||
|
|
||||||
function setupServer(done) {
|
function setupServer(done) {
|
||||||
serverApp = loopback();
|
serverApp = loopback();
|
||||||
|
serverApp.set('remoting', { errorHandler: { debug: true, log: false }});
|
||||||
serverApp.enableAuth();
|
serverApp.enableAuth();
|
||||||
|
|
||||||
serverApp.dataSource('db', { connector: 'memory' });
|
serverApp.dataSource('db', { connector: 'memory' });
|
||||||
|
|
|
@ -12,6 +12,7 @@ describe('loopback.rest', function() {
|
||||||
// override the global app object provided by test/support.js
|
// override the global app object provided by test/support.js
|
||||||
// and create a local one that does not share state with other tests
|
// and create a local one that does not share state with other tests
|
||||||
app = loopback({ localRegistry: true, loadBuiltinModels: true });
|
app = loopback({ localRegistry: true, loadBuiltinModels: true });
|
||||||
|
app.set('remoting', { errorHandler: { debug: true, log: false }});
|
||||||
var db = app.dataSource('db', { connector: 'memory' });
|
var db = app.dataSource('db', { connector: 'memory' });
|
||||||
MyModel = app.registry.createModel('MyModel');
|
MyModel = app.registry.createModel('MyModel');
|
||||||
MyModel.attachTo(db);
|
MyModel.attachTo(db);
|
||||||
|
|
|
@ -30,6 +30,7 @@ describe('User', function() {
|
||||||
// override the global app object provided by test/support.js
|
// override the global app object provided by test/support.js
|
||||||
// and create a local one that does not share state with other tests
|
// and create a local one that does not share state with other tests
|
||||||
app = loopback({ localRegistry: true, loadBuiltinModels: true });
|
app = loopback({ localRegistry: true, loadBuiltinModels: true });
|
||||||
|
app.set('remoting', { errorHandler: { debug: true, log: false }});
|
||||||
app.dataSource('db', { connector: 'memory' });
|
app.dataSource('db', { connector: 'memory' });
|
||||||
|
|
||||||
// setup Email model, it's needed by User tests
|
// setup Email model, it's needed by User tests
|
||||||
|
|
Loading…
Reference in New Issue