Ghost/test/api-acceptance/content/utils.js
Kevin Ansfield 1bc57b584a
Added posts_meta.feature_image_{alt,caption} columns (#13030)
refs https://github.com/TryGhost/Team/issues/770

We want post feature image functionality to better match what's available inside the editor, to do that we'll need somewhere to store alt and caption meta data. `posts_meta` chosen because even though we want to make this generic for other tables in the future those tables also have a `feature_image` (or closely related) field.

- updated schema with new columns
- added migration to create columns
- cleaned new columns from API output
  - not output on v2/v3
  - conditionally output on v4/canary output based on labs flag
- bumped `@tryghost/admin-api-schema` to allow new columns through in canary API requests
  - silently clean properties from input when labs flag is disabled
  - updated acceptance tests so they fail if `admin-api-schema` is not letting the new fields through
2021-06-10 20:35:56 +01:00

101 lines
2.2 KiB
JavaScript

const url = require('url');
const _ = require('lodash');
const testUtils = require('../../utils');
const API_URL = '/ghost/api/canary/content/';
const expectedProperties = {
// API top level
posts: ['posts', 'meta'],
tags: ['tags', 'meta'],
authors: ['authors', 'meta'],
pagination: ['page', 'limit', 'pages', 'total', 'next', 'prev'],
post: [
'id',
'uuid',
'title',
'slug',
'html',
'comment_id',
'feature_image',
'feature_image_alt',
'feature_image_caption',
'featured',
'visibility',
'email_recipient_filter',
'created_at',
'updated_at',
'published_at',
'custom_excerpt',
'codeinjection_head',
'codeinjection_foot',
'custom_template',
'canonical_url',
'url',
'excerpt',
'access',
'og_image',
'og_title',
'og_description',
'twitter_image',
'twitter_title',
'twitter_description',
'meta_title',
'meta_description',
'email_subject',
'frontmatter',
'reading_time'
],
author: [
'id',
'name',
'slug',
'profile_image',
'cover_image',
'bio',
'website',
'location',
'facebook',
'twitter',
'meta_title',
'meta_description'
],
tag: [
'id',
'name',
'slug',
'description',
'feature_image',
'visibility',
'og_image',
'og_title',
'og_description',
'twitter_image',
'twitter_title',
'twitter_description',
'meta_title',
'meta_description',
'codeinjection_head',
'codeinjection_foot',
'canonical_url',
'accent_color'
]
};
module.exports = {
API: {
getApiQuery(route) {
return url.resolve(API_URL, route);
},
checkResponse(...args) {
this.expectedProperties = expectedProperties;
return testUtils.API.checkResponse.call(this, ...args);
}
},
getValidKey() {
return testUtils.DataGenerator.Content.api_keys[1].secret;
}
};