mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Fixed travis
no issue - last commit failed on mysql - reverted added a new user to knex test utility - added the user in the target test @TODO: we should in the future add resources per test, without using a "global" set, otherwise you always run into trouble that you have to update a lot of tests when you add a new resource to the test set
This commit is contained in:
parent
d3b1f582ab
commit
84fcedb036
6 changed files with 23 additions and 31 deletions
|
@ -462,7 +462,7 @@ describe('Public API', function () {
|
|||
var jsonResponse = res.body;
|
||||
should.exist(jsonResponse.users);
|
||||
testUtils.API.checkResponse(jsonResponse, 'users');
|
||||
jsonResponse.users.should.have.length(7);
|
||||
jsonResponse.users.should.have.length(6);
|
||||
|
||||
// We don't expose the email address.
|
||||
testUtils.API.checkResponse(jsonResponse.users[0], 'user', null, null, null, {public: true});
|
||||
|
@ -485,7 +485,7 @@ describe('Public API', function () {
|
|||
var jsonResponse = res.body;
|
||||
should.exist(jsonResponse.users);
|
||||
testUtils.API.checkResponse(jsonResponse, 'users');
|
||||
jsonResponse.users.should.have.length(7);
|
||||
jsonResponse.users.should.have.length(6);
|
||||
|
||||
// We don't expose the email address.
|
||||
testUtils.API.checkResponse(jsonResponse.users[0], 'user', null, null, null, {public: true});
|
||||
|
@ -635,7 +635,7 @@ describe('Public API', function () {
|
|||
var jsonResponse = res.body;
|
||||
should.exist(jsonResponse.users);
|
||||
testUtils.API.checkResponse(jsonResponse, 'users');
|
||||
jsonResponse.users.should.have.length(7);
|
||||
jsonResponse.users.should.have.length(6);
|
||||
|
||||
// We don't expose the email address.
|
||||
testUtils.API.checkResponse(jsonResponse.users[0], 'user', ['count'], null, null, {public: true});
|
||||
|
@ -658,7 +658,7 @@ describe('Public API', function () {
|
|||
var jsonResponse = res.body;
|
||||
should.exist(jsonResponse.users);
|
||||
testUtils.API.checkResponse(jsonResponse, 'users');
|
||||
jsonResponse.users.should.have.length(7);
|
||||
jsonResponse.users.should.have.length(6);
|
||||
|
||||
// We don't expose the email address.
|
||||
testUtils.API.checkResponse(jsonResponse.users[0], 'user', null, null, null, {public: true});
|
||||
|
|
|
@ -23,6 +23,13 @@ describe('Users API', function () {
|
|||
'settings', 'users:roles', 'users:extra', 'user-token', 'perms:user', 'perms:role', 'perms:setting', 'perms:init', 'posts'
|
||||
));
|
||||
|
||||
before(function () {
|
||||
return testUtils.createUser({
|
||||
user: testUtils.DataGenerator.Content.users[6],
|
||||
role: 'Administrator'
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(function () {
|
||||
eventsTriggered = {};
|
||||
|
||||
|
@ -915,7 +922,7 @@ describe('Users API', function () {
|
|||
|
||||
return db.knex('users');
|
||||
}).then(function (result) {
|
||||
_.flatten(result).length.should.eql(10);
|
||||
_.flatten(result).length.should.eql(9);
|
||||
|
||||
return UserAPI.destroy(_.extend({}, context.owner, _.merge({}, options, {id: userIdFor.editor})));
|
||||
}).then(function () {
|
||||
|
@ -963,8 +970,8 @@ describe('Users API', function () {
|
|||
|
||||
return db.knex('users');
|
||||
}).then(function (allUsers) {
|
||||
// one user was deleted, that's why 9
|
||||
allUsers.length.should.eql(9);
|
||||
// one user was deleted, that's why 8
|
||||
allUsers.length.should.eql(8);
|
||||
done();
|
||||
}).catch(done);
|
||||
});
|
||||
|
|
|
@ -1705,11 +1705,11 @@ describe('Post Model', function () {
|
|||
return models.Post.destroyByAuthor(authorData);
|
||||
}).then(function (results) {
|
||||
// User 1 has 10 posts in the database
|
||||
results.length.should.equal(9);
|
||||
results.length.should.equal(10);
|
||||
return models.Post.findAll({context: {internal: true}});
|
||||
}).then(function (found) {
|
||||
// Only 40 should remain
|
||||
found.length.should.equal(41);
|
||||
found.length.should.equal(40);
|
||||
done();
|
||||
}).catch(done);
|
||||
});
|
||||
|
|
|
@ -201,7 +201,7 @@ describe('User Model', function run() {
|
|||
it('can findAll', function (done) {
|
||||
UserModel.findAll().then(function (results) {
|
||||
should.exist(results);
|
||||
results.length.should.equal(6);
|
||||
results.length.should.equal(5);
|
||||
|
||||
done();
|
||||
}).catch(done);
|
||||
|
@ -214,7 +214,7 @@ describe('User Model', function run() {
|
|||
results.meta.pagination.page.should.equal(1);
|
||||
results.meta.pagination.limit.should.equal(15);
|
||||
results.meta.pagination.pages.should.equal(1);
|
||||
results.data.length.should.equal(6);
|
||||
results.data.length.should.equal(5);
|
||||
|
||||
done();
|
||||
}).catch(done);
|
||||
|
@ -260,7 +260,7 @@ describe('User Model', function run() {
|
|||
results.meta.pagination.page.should.equal(1);
|
||||
results.meta.pagination.limit.should.equal('all');
|
||||
results.meta.pagination.pages.should.equal(1);
|
||||
results.data.length.should.equal(10);
|
||||
results.data.length.should.equal(9);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ describe('Integration: services/url/UrlService', function () {
|
|||
}
|
||||
|
||||
if (generator.router.getResourceType() === 'users') {
|
||||
generator.getUrls().length.should.eql(6);
|
||||
generator.getUrls().length.should.eql(5);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -190,9 +190,6 @@ describe('Integration: services/url/UrlService', function () {
|
|||
|
||||
url = urlService.getUrlByResourceId(testUtils.DataGenerator.forKnex.users[4].id);
|
||||
url.should.eql('/author/contributor/');
|
||||
|
||||
url = urlService.getUrlByResourceId(testUtils.DataGenerator.forKnex.users[5].id);
|
||||
url.should.eql('/author/ad-2/');
|
||||
});
|
||||
|
||||
it('getResource', function () {
|
||||
|
@ -455,7 +452,7 @@ describe('Integration: services/url/UrlService', function () {
|
|||
}
|
||||
|
||||
if (generator.router.getResourceType() === 'users') {
|
||||
generator.getUrls().length.should.eql(6);
|
||||
generator.getUrls().length.should.eql(5);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -498,9 +495,6 @@ describe('Integration: services/url/UrlService', function () {
|
|||
|
||||
url = urlService.getUrlByResourceId(testUtils.DataGenerator.forKnex.users[4].id);
|
||||
url.should.eql('/persons/contributor/');
|
||||
|
||||
url = urlService.getUrlByResourceId(testUtils.DataGenerator.forKnex.users[5].id);
|
||||
url.should.eql('/persons/ad-2/');
|
||||
});
|
||||
|
||||
describe('update resource', function () {
|
||||
|
@ -698,7 +692,7 @@ describe('Integration: services/url/UrlService', function () {
|
|||
}
|
||||
|
||||
if (generator.router.getResourceType() === 'users') {
|
||||
generator.getUrls().length.should.eql(6);
|
||||
generator.getUrls().length.should.eql(5);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -741,9 +735,6 @@ describe('Integration: services/url/UrlService', function () {
|
|||
|
||||
url = urlService.getUrlByResourceId(testUtils.DataGenerator.forKnex.users[4].id);
|
||||
url.should.eql('/persons/contributor/');
|
||||
|
||||
url = urlService.getUrlByResourceId(testUtils.DataGenerator.forKnex.users[5].id);
|
||||
url.should.eql('/persons/ad-2/');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -702,8 +702,7 @@ DataGenerator.forKnex = (function () {
|
|||
createUser(DataGenerator.Content.users[1]),
|
||||
createUser(DataGenerator.Content.users[2]),
|
||||
createUser(DataGenerator.Content.users[3]),
|
||||
createUser(DataGenerator.Content.users[7]),
|
||||
createUser(DataGenerator.Content.users[6]),
|
||||
createUser(DataGenerator.Content.users[7])
|
||||
];
|
||||
|
||||
const clients = [
|
||||
|
@ -738,11 +737,6 @@ DataGenerator.forKnex = (function () {
|
|||
id: ObjectId.generate(),
|
||||
user_id: DataGenerator.Content.users[7].id,
|
||||
role_id: DataGenerator.Content.roles[4].id
|
||||
},
|
||||
{
|
||||
id: ObjectId.generate(),
|
||||
user_id: DataGenerator.Content.users[6].id,
|
||||
role_id: DataGenerator.Content.roles[0].id
|
||||
}
|
||||
];
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue