mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Added webhook fixute utils
refs https://github.com/TryGhost/Toolbox/issues/320 - There will be more webhook e2e tests coming which require easy webhook fixture creation
This commit is contained in:
parent
c7e833545b
commit
041a32934a
2 changed files with 18 additions and 0 deletions
|
@ -281,6 +281,13 @@ const getAgentsForMembers = async () => {
|
|||
};
|
||||
};
|
||||
|
||||
const insertWebhook = ({event, url}) => {
|
||||
return fixtureUtils.fixtures.insertWebhook({
|
||||
event: event,
|
||||
target_url: url
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
// request agent
|
||||
agentProvider: {
|
||||
|
@ -297,6 +304,7 @@ module.exports = {
|
|||
// DB State Manipulation
|
||||
fixtureManager: {
|
||||
get: getFixture,
|
||||
insertWebhook: insertWebhook,
|
||||
getCurrentOwnerUser: fixtureUtils.getCurrentOwnerUser,
|
||||
init: initFixtures,
|
||||
restore: resetData,
|
||||
|
|
|
@ -436,6 +436,16 @@ const fixtures = {
|
|||
});
|
||||
},
|
||||
|
||||
insertWebhook: function (attributes) {
|
||||
const webhook = DataGenerator.forKnex.createWebhook(
|
||||
Object.assign(attributes, {
|
||||
integration_id: DataGenerator.forKnex.integrations[0].id
|
||||
})
|
||||
);
|
||||
|
||||
return models.Webhook.add(webhook, context.internal);
|
||||
},
|
||||
|
||||
insertWebhooks: function insertWebhooks() {
|
||||
return Promise.map(DataGenerator.forKnex.webhooks, function (webhook) {
|
||||
return models.Webhook.add(webhook, context.internal);
|
||||
|
|
Loading…
Add table
Reference in a new issue