0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Fixed incorrect test in functional/routes/api/posts_spec.js

no issue

- `post.author_id` has no reference to any table currently, see https://github.com/TryGhost/Ghost/blob/1.21.3/core/server/data/schema/schema.js#L19
- that's why it is right now possible to insert none existent author id's
- with multiple authors, this get's protected (see https://github.com/TryGhost/Ghost/pull/9426)
  - you would get a proper error message
  - it is not allowed to insert invalid author id's
  - as soon as you do `include=author` you would receive an error
- fixed one test case where we inserted an invalid author id via the API
This commit is contained in:
kirrg001 2018-02-21 18:39:56 +01:00
parent 789895b3de
commit d32cea479e

View file

@ -22,7 +22,7 @@ describe('Post API', function () {
request = supertest.agent(config.get('url'));
})
.then(function () {
return testUtils.doAuth(request, 'posts');
return testUtils.doAuth(request, 'users:extra', 'posts');
})
.then(function (token) {
ownerAccessToken = token;
@ -726,9 +726,10 @@ describe('Post API', function () {
var jsonResponse = res.body,
changedTitle = 'My new Title',
changedAuthor = ObjectId.generate();
changedAuthor = testUtils.DataGenerator.Content.extraUsers[0].id;
should.exist(jsonResponse.posts[0]);
jsonResponse.posts[0].author.should.not.eql(changedAuthor);
jsonResponse.posts[0].title = changedTitle;
jsonResponse.posts[0].author = changedAuthor;
jsonResponse.posts[0].custom_template = 'custom-about';