mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 03:44:29 +03:00
Updated API versions used in regression test for webhooks
refs https://github.com/TryGhost/Team/issues/513 - Tests confused versions after doing a "tripplication" - Extracted a global "API_VERSION" variable for each suite to make api version used in the test explicit
This commit is contained in:
parent
55e9ef957f
commit
e7e5f0ad15
@ -6,6 +6,7 @@ const localUtils = require('./utils');
|
||||
|
||||
describe('Webhooks API', function () {
|
||||
let request;
|
||||
const API_VERSION = 'canary';
|
||||
|
||||
before(async function () {
|
||||
await testUtils.startGhost();
|
||||
@ -19,7 +20,7 @@ describe('Webhooks API', function () {
|
||||
target_url: 'http://example.com/webhooks/test/extra/1',
|
||||
name: 'test',
|
||||
secret: 'thisissecret',
|
||||
api_version: 'v2',
|
||||
api_version: API_VERSION,
|
||||
integration_id: testUtils.DataGenerator.Content.integrations[0].id
|
||||
};
|
||||
|
||||
|
@ -8,6 +8,7 @@ const ghost = testUtils.startGhost;
|
||||
|
||||
describe('Webhooks API (canary)', function () {
|
||||
let request;
|
||||
const API_VERSION = 'canary';
|
||||
|
||||
before(function () {
|
||||
return ghost()
|
||||
@ -26,7 +27,7 @@ describe('Webhooks API (canary)', function () {
|
||||
integration_id: 'ignore_me',
|
||||
name: 'test',
|
||||
secret: 'thisissecret',
|
||||
api_version: 'v3'
|
||||
api_version: API_VERSION
|
||||
};
|
||||
|
||||
return request.post(localUtils.API.getApiQuery('webhooks/'))
|
||||
@ -49,7 +50,7 @@ describe('Webhooks API (canary)', function () {
|
||||
jsonResponse.webhooks[0].integration_id.should.eql(testUtils.DataGenerator.Content.api_keys[0].integration_id);
|
||||
jsonResponse.webhooks[0].name.should.eql('test');
|
||||
jsonResponse.webhooks[0].secret.should.eql('thisissecret');
|
||||
jsonResponse.webhooks[0].api_version.should.eql('v3');
|
||||
jsonResponse.webhooks[0].api_version.should.eql('canary');
|
||||
|
||||
localUtils.API.checkResponse(jsonResponse.webhooks[0], 'webhook');
|
||||
});
|
||||
@ -61,7 +62,7 @@ describe('Webhooks API (canary)', function () {
|
||||
target_url: 'http://example.com/webhooks/test/extra/1',
|
||||
name: 'test',
|
||||
secret: 'thisissecret',
|
||||
api_version: 'v2'
|
||||
api_version: API_VERSION
|
||||
};
|
||||
|
||||
return request.post(localUtils.API.getApiQuery('webhooks/'))
|
||||
@ -78,7 +79,7 @@ describe('Webhooks API (canary)', function () {
|
||||
target_url: 'http://example.com/webhooks/test/extra/1',
|
||||
name: 'test',
|
||||
secret: 'thisissecret',
|
||||
api_version: 'v2'
|
||||
api_version: API_VERSION
|
||||
};
|
||||
|
||||
return request.post(localUtils.API.getApiQuery('webhooks/'))
|
||||
@ -91,7 +92,7 @@ describe('Webhooks API (canary)', function () {
|
||||
|
||||
it('Fails validation when required fields are not present', function () {
|
||||
let webhookData = {
|
||||
api_version: 'v2',
|
||||
api_version: API_VERSION,
|
||||
integration_id: 'dummy'
|
||||
};
|
||||
|
||||
|
@ -8,6 +8,7 @@ const ghost = testUtils.startGhost;
|
||||
|
||||
describe('Webhooks API (v2)', function () {
|
||||
let request;
|
||||
const API_VERSION = 'v2';
|
||||
|
||||
before(function () {
|
||||
return ghost()
|
||||
@ -26,7 +27,7 @@ describe('Webhooks API (v2)', function () {
|
||||
integration_id: 'ignore_me',
|
||||
name: 'test',
|
||||
secret: 'thisissecret',
|
||||
api_version: 'v2'
|
||||
api_version: API_VERSION
|
||||
};
|
||||
|
||||
return request.post(localUtils.API.getApiQuery('webhooks/'))
|
||||
@ -47,6 +48,9 @@ describe('Webhooks API (v2)', function () {
|
||||
jsonResponse.webhooks[0].event.should.eql('test.create');
|
||||
jsonResponse.webhooks[0].target_url.should.eql('http://example.com/webhooks/test/extra/v2');
|
||||
jsonResponse.webhooks[0].integration_id.should.eql(testUtils.DataGenerator.Content.api_keys[0].integration_id);
|
||||
jsonResponse.webhooks[0].name.should.eql('test');
|
||||
jsonResponse.webhooks[0].secret.should.eql('thisissecret');
|
||||
jsonResponse.webhooks[0].api_version.should.eql('v2');
|
||||
|
||||
localUtils.API.checkResponse(jsonResponse.webhooks[0], 'webhook');
|
||||
});
|
||||
|
@ -8,6 +8,7 @@ const ghost = testUtils.startGhost;
|
||||
|
||||
describe('Webhooks API (v3)', function () {
|
||||
let request;
|
||||
const API_VERSION = 'v3';
|
||||
|
||||
before(function () {
|
||||
return ghost()
|
||||
@ -26,7 +27,7 @@ describe('Webhooks API (v3)', function () {
|
||||
integration_id: 'ignore_me',
|
||||
name: 'test',
|
||||
secret: 'thisissecret',
|
||||
api_version: 'v3'
|
||||
api_version: API_VERSION
|
||||
};
|
||||
|
||||
return request.post(localUtils.API.getApiQuery('webhooks/'))
|
||||
@ -61,7 +62,7 @@ describe('Webhooks API (v3)', function () {
|
||||
target_url: 'http://example.com/webhooks/test/extra/1',
|
||||
name: 'test',
|
||||
secret: 'thisissecret',
|
||||
api_version: 'v2'
|
||||
api_version: API_VERSION
|
||||
};
|
||||
|
||||
return request.post(localUtils.API.getApiQuery('webhooks/'))
|
||||
@ -78,7 +79,7 @@ describe('Webhooks API (v3)', function () {
|
||||
target_url: 'http://example.com/webhooks/test/extra/1',
|
||||
name: 'test',
|
||||
secret: 'thisissecret',
|
||||
api_version: 'v2'
|
||||
api_version: API_VERSION
|
||||
};
|
||||
|
||||
return request.post(localUtils.API.getApiQuery('webhooks/'))
|
||||
@ -91,7 +92,7 @@ describe('Webhooks API (v3)', function () {
|
||||
|
||||
it('Fails validation when required fields are not present', function () {
|
||||
let webhookData = {
|
||||
api_version: 'v2',
|
||||
api_version: API_VERSION,
|
||||
integration_id: 'dummy'
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user