mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-03 03:55:26 +03:00
Added email data generators in test utils
This commit is contained in:
parent
c264a5d8c4
commit
c342ea1454
@ -418,6 +418,32 @@ DataGenerator.Content = {
|
||||
type: 'admin',
|
||||
integration_id: undefined // "internal"
|
||||
}
|
||||
],
|
||||
|
||||
emails: [
|
||||
{
|
||||
id: ObjectId.generate(),
|
||||
uuid: '6b6afda6-4b5e-4893-bff6-f16859e8349a',
|
||||
status: 'sending',
|
||||
stats: '',
|
||||
email_count: 2,
|
||||
subject: 'You got mailed!',
|
||||
html: '<p>Look! I\'m an email</p>',
|
||||
plaintext: 'Waba-daba-dab-da',
|
||||
submitted_at: moment().toDate()
|
||||
},
|
||||
{
|
||||
id: ObjectId.generate(),
|
||||
uuid: '365daa11-4bf0-4614-ad43-6346387ffa00',
|
||||
status: 'failed',
|
||||
error: 'Everything went south',
|
||||
stats: '',
|
||||
email_count: 3,
|
||||
subject: 'You got mailed! Again!',
|
||||
html: '<p>What\'s that? Another email!</p>',
|
||||
plaintext: 'yes this is an email',
|
||||
submitted_at: moment().toDate()
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@ -425,6 +451,8 @@ DataGenerator.Content = {
|
||||
DataGenerator.Content.subscribers[0].post_id = DataGenerator.Content.posts[0].id;
|
||||
DataGenerator.Content.api_keys[0].integration_id = DataGenerator.Content.integrations[0].id;
|
||||
DataGenerator.Content.api_keys[1].integration_id = DataGenerator.Content.integrations[0].id;
|
||||
DataGenerator.Content.emails[0].post_id = DataGenerator.Content.posts[0].id;
|
||||
DataGenerator.Content.emails[1].post_id = DataGenerator.Content.posts[1].id;
|
||||
|
||||
DataGenerator.forKnex = (function () {
|
||||
function createBasic(overrides) {
|
||||
@ -904,6 +932,11 @@ DataGenerator.forKnex = (function () {
|
||||
createBasic(DataGenerator.Content.api_keys[2])
|
||||
];
|
||||
|
||||
const emails = [
|
||||
createBasic(DataGenerator.Content.emails[0]),
|
||||
createBasic(DataGenerator.Content.emails[1])
|
||||
];
|
||||
|
||||
return {
|
||||
createPost: createPost,
|
||||
createGenericPost: createGenericPost,
|
||||
@ -940,7 +973,8 @@ DataGenerator.forKnex = (function () {
|
||||
roles_users: roles_users,
|
||||
webhooks: webhooks,
|
||||
integrations: integrations,
|
||||
api_keys: api_keys
|
||||
api_keys: api_keys,
|
||||
emails: emails
|
||||
};
|
||||
}());
|
||||
|
||||
|
@ -464,6 +464,12 @@ fixtures = {
|
||||
return Promise.map(DataGenerator.forKnex.api_keys, function (api_key) {
|
||||
return models.ApiKey.add(api_key, module.exports.context.internal);
|
||||
});
|
||||
},
|
||||
|
||||
insertEmails: function insertEmails() {
|
||||
return Promise.map(DataGenerator.forKnex.emails, function (email) {
|
||||
return models.Email.add(email, module.exports.context.internal);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@ -613,6 +619,9 @@ toDoList = {
|
||||
},
|
||||
api_keys: function insertApiKeys() {
|
||||
return fixtures.insertApiKeys();
|
||||
},
|
||||
emails: function insertEmails() {
|
||||
return fixtures.insertEmails();
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user