2018-10-07 17:36:02 +03:00
|
|
|
const url = require('url');
|
|
|
|
const _ = require('lodash');
|
2019-09-20 18:02:45 +03:00
|
|
|
const testUtils = require('../../utils');
|
2021-05-13 15:19:33 +03:00
|
|
|
|
2019-09-20 18:02:45 +03:00
|
|
|
const API_URL = '/ghost/api/canary/content/';
|
2018-10-07 17:36:02 +03:00
|
|
|
|
2018-12-17 18:14:36 +03:00
|
|
|
const expectedProperties = {
|
|
|
|
// API top level
|
|
|
|
posts: ['posts', 'meta'],
|
|
|
|
tags: ['tags', 'meta'],
|
|
|
|
authors: ['authors', 'meta'],
|
|
|
|
pagination: ['page', 'limit', 'pages', 'total', 'next', 'prev'],
|
2018-12-17 19:45:07 +03:00
|
|
|
|
2021-05-13 14:40:17 +03:00
|
|
|
post: [
|
|
|
|
'id',
|
|
|
|
'uuid',
|
|
|
|
'title',
|
|
|
|
'slug',
|
|
|
|
'html',
|
|
|
|
'comment_id',
|
|
|
|
'feature_image',
|
2021-06-10 22:35:56 +03:00
|
|
|
'feature_image_alt',
|
|
|
|
'feature_image_caption',
|
2021-05-13 14:40:17 +03:00
|
|
|
'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'
|
|
|
|
],
|
2021-05-13 15:19:33 +03:00
|
|
|
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'
|
|
|
|
]
|
2018-12-17 18:14:36 +03:00
|
|
|
};
|
|
|
|
|
2018-10-07 17:36:02 +03:00
|
|
|
module.exports = {
|
|
|
|
API: {
|
|
|
|
getApiQuery(route) {
|
|
|
|
return url.resolve(API_URL, route);
|
2018-12-17 18:14:36 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
checkResponse(...args) {
|
|
|
|
this.expectedProperties = expectedProperties;
|
|
|
|
return testUtils.API.checkResponse.call(this, ...args);
|
2018-10-07 17:36:02 +03:00
|
|
|
}
|
2018-10-15 12:23:34 +03:00
|
|
|
},
|
|
|
|
getValidKey() {
|
2019-01-18 19:37:58 +03:00
|
|
|
return testUtils.DataGenerator.Content.api_keys[1].secret;
|
2018-10-07 17:36:02 +03:00
|
|
|
}
|
|
|
|
};
|