From a372a84e8296c88485e9e3c818f1574242483652 Mon Sep 17 00:00:00 2001 From: Naz Date: Wed, 27 Apr 2022 16:24:50 +0800 Subject: [PATCH] Fixed test query using outdated `author_id` filter refs https://github.com/TryGhost/Toolbox/issues/230 - The `author_id` column is gone, so is the support for filtering posts by single author's id. Using author's slug(s) is the closest alternative to achieve the same result --- test/e2e-api/admin/users.test.js | 5 +++-- test/utils/e2e-utils.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/e2e-api/admin/users.test.js b/test/e2e-api/admin/users.test.js index f563fe3bc6..d850f2c269 100644 --- a/test/e2e-api/admin/users.test.js +++ b/test/e2e-api/admin/users.test.js @@ -198,10 +198,11 @@ describe('User API', function () { it('Can destroy an active user and transfer posts to the owner', async function () { const userId = testUtils.getExistingData().users[1].id; + const userSlug = testUtils.getExistingData().users[1].slug; const ownerId = testUtils.getExistingData().users[0].id; const res = await request - .get(localUtils.API.getApiQuery(`posts/?filter=author_id:${userId}`)) + .get(localUtils.API.getApiQuery(`posts/?filter=authors:${userSlug}`)) .set('Origin', config.get('url')) .expect(200); @@ -243,7 +244,7 @@ describe('User API', function () { .expect(404); const res3 = await request - .get(localUtils.API.getApiQuery(`posts/?filter=author_id:${userId}`)) + .get(localUtils.API.getApiQuery(`posts/?filter=authors:${userSlug}}`)) .set('Origin', config.get('url')) .expect(200); diff --git a/test/utils/e2e-utils.js b/test/utils/e2e-utils.js index b4e6f48f63..4ffc147a0d 100644 --- a/test/utils/e2e-utils.js +++ b/test/utils/e2e-utils.js @@ -41,7 +41,7 @@ let totalBoots = 0; const exposeFixtures = async () => { const fixturePromises = { roles: models.Role.findAll({columns: ['id']}), - users: models.User.findAll({columns: ['id', 'email']}), + users: models.User.findAll({columns: ['id', 'email', 'slug']}), tags: models.Tag.findAll({columns: ['id']}), apiKeys: models.ApiKey.findAll({withRelated: 'integration'}) };