From 549885123d253c972b81c372cc6f7ef715c3b144 Mon Sep 17 00:00:00 2001 From: kennethlynne Date: Mon, 1 Jun 2015 14:39:45 +0200 Subject: [PATCH 01/16] classify model names --- lib/helpers.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/helpers.js b/lib/helpers.js index 994edcd..03ae5da 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -138,9 +138,9 @@ _beforeEach.givenUserWithRole = function (attrs, role, optionalHandler) { } test.userRole = result; - test.app.models.roleMapping.create( + test.app.models.RoleMapping.create( {principalId: test.user.id, - principalType: test.app.models.roleMapping.USER, + principalType: test.app.models.RoleMapping.USER, roleId: result.id}, function (err, result) { if(err) { @@ -222,11 +222,11 @@ _beforeEach.givenLoggedInUserWithRole = function(credentials, role, optionalHand } _beforeEach.givenAnUnauthenticatedToken = function(attrs, optionalHandler) { - _beforeEach.givenModel('accessToken', attrs, optionalHandler); + _beforeEach.givenModel('AccessToken', attrs, optionalHandler); } _beforeEach.givenAnAnonymousToken = function(attrs, optionalHandler) { - _beforeEach.givenModel('accessToken', {id: '$anonymous'}, optionalHandler); + _beforeEach.givenModel('AccessToken', {id: '$anonymous'}, optionalHandler); } _describe.whenCalledRemotely = function(verb, url, data, cb) { From 9c4cf38e3443183393d54b81a9faa9ae9a918053 Mon Sep 17 00:00:00 2001 From: kennethlynne Date: Mon, 1 Jun 2015 14:47:21 +0200 Subject: [PATCH 02/16] add CRUD helpers --- lib/helpers.js | 59 ++++++++++++++++++++++++++++++++++++++++++++++---- test/test.js | 5 +++++ 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/lib/helpers.js b/lib/helpers.js index 03ae5da..27abbb4 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -36,7 +36,7 @@ _beforeEach.cleanDatasource = function(dsName) { this.app.datasources[dsName].automigrate(); this.app.datasources[dsName].connector.ids = {}; } - + done(); }); } @@ -125,7 +125,7 @@ _beforeEach.givenModel = function(modelName, attrs, optionalHandler) { _beforeEach.givenUser = function(attrs, optionalHandler) { _beforeEach.givenModel('user', attrs, optionalHandler); -} +} _beforeEach.givenUserWithRole = function (attrs, role, optionalHandler) { _beforeEach.givenUser(attrs, function (done) { @@ -148,7 +148,7 @@ _beforeEach.givenUserWithRole = function (attrs, role, optionalHandler) { if(err.details) console.error(err.details); return done(err); } - + test.userRoleMapping = result; done(); } @@ -306,7 +306,7 @@ _describe.whenCalledByUserWithRole = function (credentials, role, verb, url, dat describe('when called by logged in user with role ' + role, function () { _beforeEach.givenLoggedInUserWithRole(credentials, role); _describe.whenCalledRemotely(verb, url, data, cb); - }); + }); } _describe.whenCalledAnonymously = function(verb, url, data, cb) { @@ -404,3 +404,54 @@ function(credentials, role, verb, url) { _it.shouldBeDenied(); }); } + +_it.shouldBeValidCreateResponse = +function () { + _it.shouldBeAllowed(); + it('should respond with a valid POST response', function () { + assert.equal(this.res.statusCode, 200); + assert(this.res.body.id); + }); +} + +_it.shouldBeValidGetAllResponse = +function () { + _it.shouldBeAllowed(); + it('should respond with a valid GET response', function () { + assert.equal(this.res.statusCode, 200); + assert(Array.isArray(this.res.body)); + }); +} + +_it.shouldBeValidGetByIdResponse = +function (id) { + _it.shouldBeAllowed(); + it('should respond with a valid GET response', + function () { + assert.equal(this.res.statusCode, 200); + assert.equal(this.res.body.id, id); + }); +} + +_it.shouldBeValidUpdateResponse = +function (newVal) { + _it.shouldBeAllowed(); + it('should respond with a valid PUT response', + function () { + assert.equal(this.res.statusCode, 200); + var props = Object.keys(newVal); + var val = this.res.body; + props.forEach(function (prop) { + assert.equal(val[prop], newVal[prop]); + }); + }); +} + +_it.shouldBeValidDeleteResponse = +function () { + _it.shouldBeAllowed(); + it('should have statusCode 204', + function () { + assert.equal(this.res.statusCode, 204); + }); +} \ No newline at end of file diff --git a/test/test.js b/test/test.js index 70b4448..52d6f35 100644 --- a/test/test.js +++ b/test/test.js @@ -19,6 +19,11 @@ describe('helpers', function () { 'shouldBeAllowedWhenCalledUnauthenticated', 'shouldBeDeniedWhenCalledUnauthenticated', 'shouldBeAllowedWhenCalledByUser', + 'shouldBeValidCreateResponse', + 'shouldBeValidGetAllResponse', + 'shouldBeValidGetByIdResponse', + 'shouldBeValidUpdateResponse', + 'shouldBeValidDeleteResponse', 'shouldBeDeniedWhenCalledByUser'] .forEach(function(func) { it('should have a method named ' + func, function () { From 523cf044f3fd595c4024f81488c9373d8585a517 Mon Sep 17 00:00:00 2001 From: kennethlynne Date: Mon, 1 Jun 2015 16:13:23 +0200 Subject: [PATCH 03/16] classify model name --- lib/helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/helpers.js b/lib/helpers.js index 27abbb4..0b2f249 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -124,7 +124,7 @@ _beforeEach.givenModel = function(modelName, attrs, optionalHandler) { } _beforeEach.givenUser = function(attrs, optionalHandler) { - _beforeEach.givenModel('user', attrs, optionalHandler); + _beforeEach.givenModel('User', attrs, optionalHandler); } _beforeEach.givenUserWithRole = function (attrs, role, optionalHandler) { From 626dc91ce06a352c424453a246c63538bc70b9a2 Mon Sep 17 00:00:00 2001 From: kennethlynne Date: Mon, 1 Jun 2015 17:26:35 +0200 Subject: [PATCH 04/16] classify model name --- lib/helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/helpers.js b/lib/helpers.js index 0b2f249..c555723 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -178,7 +178,7 @@ _beforeEach.givenUserWithRole = function (attrs, role, optionalHandler) { _beforeEach.givenLoggedInUser = function(credentials, optionalHandler) { _beforeEach.givenUser(credentials, function(done) { var test = this; - this.user.constructor.login(credentials, function(err, token) { + this.User.constructor.login(credentials, function(err, token) { if(err) { done(err); } else { From 117dfe577169f82abec7ec0e8bd9b20f6d9ab008 Mon Sep 17 00:00:00 2001 From: kennethlynne Date: Fri, 5 Jun 2015 20:45:39 +0200 Subject: [PATCH 05/16] fix conflict --- lib/helpers.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/helpers.js b/lib/helpers.js index 2c1bd73..fe39158 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -135,11 +135,7 @@ _beforeEach.withUserModel = function(model) { }; _beforeEach.givenUser = function(attrs, optionalHandler) { -<<<<<<< HEAD - _beforeEach.givenModel('User', attrs, optionalHandler); -======= _beforeEach.givenModel('__USERMODEL__', attrs, optionalHandler); ->>>>>>> 9320b20332554db0e4d59cef7e8f8c9726d164bd } _beforeEach.givenUserWithRole = function (attrs, role, optionalHandler) { From b73c3ca253d5ea68cda59dbe7998454e3c76a671 Mon Sep 17 00:00:00 2001 From: Are Almaas Date: Mon, 8 Jun 2015 11:00:32 +0200 Subject: [PATCH 06/16] change to ETAccessToken --- lib/helpers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/helpers.js b/lib/helpers.js index fe39158..e6bd42d 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -233,11 +233,11 @@ _beforeEach.givenLoggedInUserWithRole = function(credentials, role, optionalHand } _beforeEach.givenAnUnauthenticatedToken = function(attrs, optionalHandler) { - _beforeEach.givenModel('AccessToken', attrs, optionalHandler); + _beforeEach.givenModel('ETAccessToken', attrs, optionalHandler); } _beforeEach.givenAnAnonymousToken = function(attrs, optionalHandler) { - _beforeEach.givenModel('AccessToken', {id: '$anonymous'}, optionalHandler); + _beforeEach.givenModel('ETAccessToken', {id: '$anonymous'}, optionalHandler); } _describe.whenCalledRemotely = function(verb, url, data, cb) { From e483a16b6b1f8d9658f08f9716710e2381c7158e Mon Sep 17 00:00:00 2001 From: Are Almaas Date: Mon, 8 Jun 2015 12:45:04 +0200 Subject: [PATCH 07/16] allow for inherited user models --- lib/helpers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/helpers.js b/lib/helpers.js index e6bd42d..71b1b4b 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -189,7 +189,7 @@ _beforeEach.givenUserWithRole = function (attrs, role, optionalHandler) { _beforeEach.givenLoggedInUser = function(credentials, optionalHandler) { _beforeEach.givenUser(credentials, function(done) { var test = this; - this.app.models[this.userModel].constructor.login(credentials, function(err, token) { + this.app.models[this.userModel].login(credentials, function(err, token) { if(err) { done(err); } else { @@ -212,7 +212,7 @@ _beforeEach.givenLoggedInUser = function(credentials, optionalHandler) { _beforeEach.givenLoggedInUserWithRole = function(credentials, role, optionalHandler){ _beforeEach.givenUserWithRole(credentials, role, function(done) { var test = this; - this.app.models[this.userModel].constructor.login(credentials, function(err, token) { + this.app.models[this.userModel].login(credentials, function(err, token) { if(err) { done(err); } else { From 3b2c6df467451f443666ba37abb6bfbecb103abf Mon Sep 17 00:00:00 2001 From: kennethlynne Date: Wed, 17 Jun 2015 23:48:46 +0200 Subject: [PATCH 08/16] improve all the things --- lib/helpers.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/helpers.js b/lib/helpers.js index 71b1b4b..8153097 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -95,6 +95,10 @@ _beforeEach.givenModel = function(modelName, attrs, optionalHandler) { modelName = this.userModel ? this.userModel : 'user'; } + if(modelName === '__ACCESSTOKENMODEL__') { + modelName = this.accessTokenModel ? this.accessTokenModel : 'AccessToken'; + } + var test = this; var app = this.app; var model = app.models[modelName]; @@ -134,6 +138,13 @@ _beforeEach.withUserModel = function(model) { }); }; +_beforeEach.withAccessTokenModel = function(model) { + beforeEach(function(done) { + this.accessTokenModel = model; + done(); + }); +}; + _beforeEach.givenUser = function(attrs, optionalHandler) { _beforeEach.givenModel('__USERMODEL__', attrs, optionalHandler); } @@ -233,11 +244,11 @@ _beforeEach.givenLoggedInUserWithRole = function(credentials, role, optionalHand } _beforeEach.givenAnUnauthenticatedToken = function(attrs, optionalHandler) { - _beforeEach.givenModel('ETAccessToken', attrs, optionalHandler); + _beforeEach.givenModel('__ACCESSTOKENMODEL__', attrs, optionalHandler); } _beforeEach.givenAnAnonymousToken = function(attrs, optionalHandler) { - _beforeEach.givenModel('ETAccessToken', {id: '$anonymous'}, optionalHandler); + _beforeEach.givenModel('__ACCESSTOKENMODEL__', {id: '$anonymous'}, optionalHandler); } _describe.whenCalledRemotely = function(verb, url, data, cb) { From 28631b9a9be367892e725e3a9cf020ee045f6a12 Mon Sep 17 00:00:00 2001 From: kennethlynne Date: Wed, 17 Jun 2015 23:55:05 +0200 Subject: [PATCH 09/16] awesomify --- lib/helpers.js | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/lib/helpers.js b/lib/helpers.js index 8153097..1a1b175 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -96,7 +96,15 @@ _beforeEach.givenModel = function(modelName, attrs, optionalHandler) { } if(modelName === '__ACCESSTOKENMODEL__') { - modelName = this.accessTokenModel ? this.accessTokenModel : 'AccessToken'; + modelName = this.accessTokenModel ? this.accessTokenModel : 'accessToken'; + } + + if(modelName === '__ROLEMAPPINGMODEL__') { + modelName = this.roleMappingModel ? this.roleMappingModel : 'roleMapping'; + } + + if(modelName === '__ROLEMODEL__') { + modelName = this.roleModel ? this.roleModel : 'role'; } var test = this; @@ -145,6 +153,20 @@ _beforeEach.withAccessTokenModel = function(model) { }); }; +_beforeEach.withRoleMappingModel = function(model) { + beforeEach(function(done) { + this.roleMappingModel = model; + done(); + }); +}; + +_beforeEach.withRoleModel = function(model) { + beforeEach(function(done) { + this.roleModel = model; + done(); + }); +}; + _beforeEach.givenUser = function(attrs, optionalHandler) { _beforeEach.givenModel('__USERMODEL__', attrs, optionalHandler); } @@ -152,7 +174,7 @@ _beforeEach.givenUser = function(attrs, optionalHandler) { _beforeEach.givenUserWithRole = function (attrs, role, optionalHandler) { _beforeEach.givenUser(attrs, function (done) { var test = this; - test.app.models.Role.findOrCreate({name: role}, function (err, result) { + test.app.models[this.roleModel].findOrCreate({name: role}, function (err, result) { if(err) { console.error(err.message); if(err.details) console.error(err.details); @@ -160,9 +182,9 @@ _beforeEach.givenUserWithRole = function (attrs, role, optionalHandler) { } test.userRole = result; - test.app.models.RoleMapping.create( + test.app.models[this.roleMappingModel].create( {principalId: test.user.id, - principalType: test.app.models.RoleMapping.USER, + principalType: test.app.models[this.roleMappingModel].USER, roleId: result.id}, function (err, result) { if(err) { From d2d500de50d1fb10dd02c7908406a9de1f6d25d2 Mon Sep 17 00:00:00 2001 From: kennethlynne Date: Sat, 27 Jun 2015 00:21:19 +0200 Subject: [PATCH 10/16] fix backwards compatibility --- lib/helpers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/helpers.js b/lib/helpers.js index 1a1b175..5f4a312 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -104,7 +104,7 @@ _beforeEach.givenModel = function(modelName, attrs, optionalHandler) { } if(modelName === '__ROLEMODEL__') { - modelName = this.roleModel ? this.roleModel : 'role'; + modelName = this.roleModel ? this.roleModel : 'Role'; } var test = this; @@ -504,4 +504,4 @@ function () { function () { assert.equal(this.res.statusCode, 204); }); -} \ No newline at end of file +} From cc4b2eba5710097b22c12cb69684d81d1bf05308 Mon Sep 17 00:00:00 2001 From: Are Almaas Date: Mon, 13 Jul 2015 09:50:47 +0200 Subject: [PATCH 11/16] add helper for statuscode 403 --- lib/helpers.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/helpers.js b/lib/helpers.js index 58ca067..bdf6883 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -397,6 +397,13 @@ _it.shouldBeDenied = function() { }); } +_it.shouldBeForbidden = function() { + it('should be forbidden', function() { + assert(this.res); + assert.equal(this.res.statusCode, 403); + }); +} + _it.shouldNotBeFound = function() { it('should not be found', function() { assert(this.res); From 675c0f471193d88902850228bfd42055e4382de9 Mon Sep 17 00:00:00 2001 From: kennethlynne Date: Wed, 15 Jul 2015 02:49:06 +0200 Subject: [PATCH 12/16] log body on error --- lib/helpers.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lib/helpers.js b/lib/helpers.js index bdf6883..a14ad54 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -383,6 +383,9 @@ _it.shouldBeAllowed = function() { assert(this.req); assert(this.res); // expect success - status 2xx or 3xx + if (this.res.statusCode < 100 || this.res.statusCode > 399) { + console.log(this.res.body); + } expect(this.res.statusCode).to.be.within(100, 399); }); } @@ -393,6 +396,9 @@ _it.shouldBeDenied = function() { var expectedStatus = this.aclErrorStatus || this.app && this.app.get('aclErrorStatus') || 401; + if (this.res.statusCode !== expectedStatus) { + console.log(this.res.body); + } expect(this.res.statusCode).to.equal(expectedStatus); }); } @@ -400,6 +406,9 @@ _it.shouldBeDenied = function() { _it.shouldBeForbidden = function() { it('should be forbidden', function() { assert(this.res); + if (this.res.statusCode !== 403) { + console.log(this.res.body); + } assert.equal(this.res.statusCode, 403); }); } @@ -407,6 +416,9 @@ _it.shouldBeForbidden = function() { _it.shouldNotBeFound = function() { it('should not be found', function() { assert(this.res); + if (this.res.statusCode !== 404) { + console.log(this.res.body); + } assert.equal(this.res.statusCode, 404); }); } @@ -471,6 +483,9 @@ _it.shouldBeValidCreateResponse = function () { _it.shouldBeAllowed(); it('should respond with a valid POST response', function () { + if (this.res.statusCode !== 200) { + console.log(this.res.body); + } assert.equal(this.res.statusCode, 200); assert(this.res.body.id); }); @@ -480,6 +495,9 @@ _it.shouldBeValidGetAllResponse = function () { _it.shouldBeAllowed(); it('should respond with a valid GET response', function () { + if (this.res.statusCode !== 200) { + console.log(this.res.body); + } assert.equal(this.res.statusCode, 200); assert(Array.isArray(this.res.body)); }); @@ -490,6 +508,9 @@ function (id) { _it.shouldBeAllowed(); it('should respond with a valid GET response', function () { + if (this.res.statusCode !== 200) { + console.log(this.res.body); + } assert.equal(this.res.statusCode, 200); assert.equal(this.res.body.id, id); }); @@ -500,6 +521,9 @@ function (newVal) { _it.shouldBeAllowed(); it('should respond with a valid PUT response', function () { + if (this.res.statusCode !== 200) { + console.log(this.res.body); + } assert.equal(this.res.statusCode, 200); var props = Object.keys(newVal); var val = this.res.body; @@ -514,6 +538,9 @@ function () { _it.shouldBeAllowed(); it('should have statusCode 204', function () { + if (this.res.statusCode !== 204) { + console.log(this.res.body); + } assert.equal(this.res.statusCode, 204); }); } From dcdd10718f5a1bbc224aaa23011b1487c7091caa Mon Sep 17 00:00:00 2001 From: kennethlynne Date: Wed, 15 Jul 2015 03:21:28 +0200 Subject: [PATCH 13/16] better logging --- lib/helpers.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/helpers.js b/lib/helpers.js index a14ad54..2dc038d 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -121,6 +121,7 @@ _beforeEach.givenModel = function(modelName, attrs, optionalHandler) { model.create(attrs, function(err, result) { if(err) { console.error(err.message); + console.error('Tried creating ' + modelName, attrs); if(err.details) console.error(err.details); done(err); } else { From 0719b31a2a2c3166945f3278f390d1948f9d9a5a Mon Sep 17 00:00:00 2001 From: Are Almaas Date: Wed, 12 Aug 2015 20:19:38 +0200 Subject: [PATCH 14/16] add helper method for notfound when unauthenticated --- lib/helpers.js | 7 +++++++ test/test.js | 1 + 2 files changed, 8 insertions(+) diff --git a/lib/helpers.js b/lib/helpers.js index 2dc038d..4e3cacb 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -452,6 +452,13 @@ function(verb, url) { }); } +_it.shouldBeNotFoundWhenCalledUnauthenticated = +function(verb, url) { + _describe.whenCalledUnauthenticated(verb, url, function() { + _it.shouldNotBeFound(); + }); +} + _it.shouldBeAllowedWhenCalledByUser = function(credentials, verb, url, data) { _describe.whenCalledByUser(credentials, verb, url, data, function() { diff --git a/test/test.js b/test/test.js index 52d6f35..87ea0a3 100644 --- a/test/test.js +++ b/test/test.js @@ -18,6 +18,7 @@ describe('helpers', function () { 'shouldBeDeniedWhenCalledAnonymously', 'shouldBeAllowedWhenCalledUnauthenticated', 'shouldBeDeniedWhenCalledUnauthenticated', + 'shouldBeNotFoundWhenCalledUnauthenticated', 'shouldBeAllowedWhenCalledByUser', 'shouldBeValidCreateResponse', 'shouldBeValidGetAllResponse', From bc56524a5495931c909b947147329e1f3e38c057 Mon Sep 17 00:00:00 2001 From: kennethlynne Date: Tue, 20 Oct 2015 10:23:11 +0200 Subject: [PATCH 15/16] add shouldBeRejected helper --- lib/helpers.js | 17 +++++++++++++++++ test/test.js | 1 + 2 files changed, 18 insertions(+) diff --git a/lib/helpers.js b/lib/helpers.js index 4e3cacb..5200415 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -404,6 +404,23 @@ _it.shouldBeDenied = function() { }); } +_it.shouldBeRejected = function(statusCode) { + it('should be rejected' + (statusCode ? ' with status code ' + statusCode : ''), function() { + assert(this.res); + if (statusCode) { + if (this.res.statusCode !== statusCode) { + console.log(this.res.body); + } + expect(this.res.statusCode).to.equal(statusCode); + } else { + if (this.res.statusCode < 400 || this.res.statusCode > 499) { + console.log(this.res.body); + } + expect(this.res.statusCode).to.be.within(400, 499); + } + }); +} + _it.shouldBeForbidden = function() { it('should be forbidden', function() { assert(this.res); diff --git a/test/test.js b/test/test.js index 87ea0a3..2ac4d6c 100644 --- a/test/test.js +++ b/test/test.js @@ -13,6 +13,7 @@ describe('helpers', function () { describe('helpers.it', function() { ['shouldBeAllowed', 'shouldBeDenied', + 'shouldBeRejected', 'shouldNotBeFound', 'shouldBeAllowedWhenCalledAnonymously', 'shouldBeDeniedWhenCalledAnonymously', From 30094e6f54e5ac2eb300c3566daeb26e5c9a783b Mon Sep 17 00:00:00 2001 From: Are Almaas Date: Thu, 10 Dec 2015 16:27:33 +0100 Subject: [PATCH 16/16] change delete response code --- lib/helpers.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/helpers.js b/lib/helpers.js index 42b97c8..7dace91 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -561,11 +561,11 @@ function (newVal) { _it.shouldBeValidDeleteResponse = function () { _it.shouldBeAllowed(); - it('should have statusCode 204', + it('should have statusCode 200', function () { - if (this.res.statusCode !== 204) { + if (this.res.statusCode !== 200) { console.log(this.res.body); } - assert.equal(this.res.statusCode, 204); + assert.equal(this.res.statusCode, 200); }); }