Ghost/core/test/utils/fixtures/data-generator.js

455 lines
41 KiB
JavaScript
Raw Normal View History

2014-02-05 12:40:30 +04:00
var _ = require('lodash'),
uuid = require('node-uuid'),
DataGenerator = {};
DataGenerator.Content = {
posts: [
{
title: "HTML Ipsum",
slug: "html-ipsum",
markdown: "<h1>HTML Ipsum Presents</h1><p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href=\"#\">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p><h2>Header Level 2</h2><ol><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li><li>Aliquam tincidunt mauris eu risus.</li></ol><blockquote><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.</p></blockquote><h3>Header Level 3</h3><ul><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li><li>Aliquam tincidunt mauris eu risus.</li></ul><pre><code>#header h1 a{display: block;width: 300px;height: 80px;}</code></pre>"
},
{
title: "Ghostly Kitchen Sink",
slug: "ghostly-kitchen-sink",
markdown: "<h1>HTML Ipsum Presents</h1><p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href=\"#\">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p><h2>Header Level 2</h2><ol><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li><li>Aliquam tincidunt mauris eu risus.</li></ol><blockquote><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.</p></blockquote><h3>Header Level 3</h3><ul><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li><li>Aliquam tincidunt mauris eu risus.</li></ul><pre><code>#header h1 a{display: block;width: 300px;height: 80px;}</code></pre>"
},
{
title: "Short and Sweet",
slug: "short-and-sweet",
markdown: "## testing\n\nmctesters\n\n- test\n- line\n- items",
html: "<h2 id=\"testing\">testing</h2>\n\n<p>mctesters</p>\n\n<ul>\n<li>test</li>\n<li>line</li>\n<li>items</li>\n</ul>"
},
{
title: "Not finished yet",
slug: "unfinished",
markdown: "<h1>HTML Ipsum Presents</h1><p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href=\"#\">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p><h2>Header Level 2</h2><ol><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li><li>Aliquam tincidunt mauris eu risus.</li></ol><blockquote><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.</p></blockquote><h3>Header Level 3</h3><ul><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li><li>Aliquam tincidunt mauris eu risus.</li></ul><pre><code>#header h1 a{display: block;width: 300px;height: 80px;}</code></pre>",
status: "draft"
},
{
title: "Not so short, bit complex",
slug: "not-so-short-bit-complex",
markdown: "<p><nav><ul><li><a href=\"#nowhere\" title=\"Lorum ipsum dolor sit amet\">Lorem</a></li><li><a href=\"#nowhere\" title=\"Aliquam tincidunt mauris eu risus\">Aliquam</a></li><li><a href=\"#nowhere\" title=\"Morbi in sem quis dui placerat ornare\">Morbi</a></li><li><a href=\"#nowhere\" title=\"Praesent dapibus, neque id cursus faucibus\">Praesent</a></li><li><a href=\"#nowhere\" title=\"Pellentesque fermentum dolor\">Pellentesque</a></li></ul></nav><p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p><table><thead><tr><th>1</th><th>2</th><th>3</th><th>4</th></tr></thead><tbody><tr><td>a</td><td>b</td><td>c</td><td>d</td></tr><tr><td>e</td><td>f</td><td>g</td><td>h</td></tr><tr><td>i</td><td>j</td><td>k</td><td>l</td></tr></tbody></table><dl><dt>Definition list</dt><dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd><dt>Lorem ipsum dolor sit amet</dt><dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd></dl><ul><li>Morbi in sem quis dui placerat ornare. Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu. Cras consequat.</li><li>Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus.</li><li>Phasellus ultrices nulla quis nibh. Quisque a lectus. Donec consectetuer ligula vulputate sem tristique cursus. Nam nulla quam, gravida non, commodo a, sodales sit amet, nisi.</li><li>Pellentesque fermentum dolor. Aliquam quam lectus, facilisis auctor, ultrices ut, elementum vulputate, nunc.</li></ul></p>"
},
{
title: "This is a static page",
slug: "static-page-test",
markdown: "<h1>Static page test is what this is for.</h1><p>Hopefully you don't find it a bore.</p>",
page: 1
},
{
title: "This is a draft static page",
slug: "static-page-draft",
markdown: "<h1>Static page test is what this is for.</h1><p>Hopefully you don't find it a bore.</p>",
page: 1,
status: "draft"
}
],
tags: [
{
name: "kitchen sink",
slug: "kitchen-sink"
},
{
name: "bacon",
slug: "bacon"
},
{
name: "chorizo",
slug: "chorizo"
},
{
name: "pollo",
slug: "pollo"
},
{
name: "injection",
slug: "injection"
}
],
// Password = Sl1m3rson
users: [
{
name: 'Joe Bloggs',
slug: 'joe-blogs',
email: 'jbloggs@example.com',
password: '$2a$10$.pZeeBE0gHXd0PTnbT/ph.GEKgd0Wd3q2pWna3ynTGBkPKnGIKZL6',
status: 'active'
},
{
name: 'Smith Wellingsworth',
slug: 'smith-wellingsworth',
email: 'swellingsworth@example.com',
password: '$2a$10$.pZeeBE0gHXd0PTnbT/ph.GEKgd0Wd3q2pWna3ynTGBkPKnGIKZL6',
status: 'invited-pending'
},
{
name: 'Jimothy Bogendath',
slug: 'jimothy-bogendath',
2013-11-18 04:34:02 +04:00
email: 'jbOgendAth@example.com',
password: '$2a$10$.pZeeBE0gHXd0PTnbT/ph.GEKgd0Wd3q2pWna3ynTGBkPKnGIKZL6',
status: 'warn-1'
},
{
name: 'Slimer McEctoplasm',
slug: 'slimer-mcectoplasm',
email: 'smcectoplasm@example.com',
password: '$2a$10$.pZeeBE0gHXd0PTnbT/ph.GEKgd0Wd3q2pWna3ynTGBkPKnGIKZL6',
status: 'warn-2'
},
{
name: 'Ivan Email',
slug: 'ivan-email',
email: 'info@ghost.org',
password: '$2a$10$.pZeeBE0gHXd0PTnbT/ph.GEKgd0Wd3q2pWna3ynTGBkPKnGIKZL6',
status: 'inactive'
}
],
permissions: [
{
name: 'Browse posts',
action_type: 'browse',
object_type: 'post'
},
{
name: 'test',
action_type: 'edit',
object_type: 'post'
},
{
name: 'test',
action_type: 'edit',
object_type: 'tag'
},
{
name: 'test',
action_type: 'edit',
object_type: 'user'
},
{
name: 'test',
action_type: 'edit',
object_type: 'page'
},
{
name: 'test',
action_type: 'add',
object_type: 'post'
},
{
name: 'test',
action_type: 'add',
object_type: 'user'
},
{
name: 'test',
action_type: 'add',
object_type: 'page'
},
{
name: 'test',
action_type: 'destroy',
object_type: 'post'
},
{
name: 'test',
action_type: 'destroy',
object_type: 'user'
}
],
roles: [
{
name: 'Administrator',
description: 'Administrators'
},
{
name: 'Editor',
description: 'Editors'
},
{
name: 'Author',
description: 'Authors'
},
{
name: 'Owner',
description: 'Blog Owner'
}
],
apps: [
{
name: 'Kudos',
slug: 'kudos',
version: '0.0.1',
status: 'installed'
},
{
name: 'Importer',
slug: 'importer',
version: '0.1.0',
status: 'inactive'
},
{
name: 'Hemingway',
slug: 'hemingway',
version: '1.0.0',
status: 'installed'
}
],
app_fields: [
{
key: 'count',
value: '120',
type: 'number',
active: true
},
{
key: 'words',
value: '512',
type: 'number',
active: true
}
],
app_settings: [
{
key: 'color',
value: 'ghosty'
},
{
key: 'setting',
value: 'value'
}
]
};
DataGenerator.forKnex = (function () {
var posts,
tags,
posts_tags,
apps,
app_fields,
roles,
users,
roles_users;
function createBasic(overrides) {
return _.defaults(overrides, {
uuid: uuid.v4(),
created_by: 1,
created_at: new Date(),
updated_by: 1,
updated_at: new Date()
});
}
function createPost(overrides) {
return _.defaults(overrides, {
uuid: uuid.v4(),
status: 'published',
html: overrides.markdown,
language: 'en_US',
featured: true,
page: false,
author_id: 1,
updated_at: new Date(),
updated_by: 1,
created_at: new Date(),
created_by: 1,
published_at: new Date(),
published_by: 1
});
}
function createGenericPost(uniqueInteger, status, language, author_id) {
status = status || 'draft';
language = language || 'en_US';
author_id = author_id || 1;
return createPost({
uuid: uuid.v4(),
title: 'Test Post ' + uniqueInteger,
slug: 'ghost-from-fiction-to-function-' + uniqueInteger,
author_id: author_id,
markdown: "Three days ago I released a <a title=\"Ghost\" href=\"http:\/\/john.onolan.org\/ghost\/\">concept page<\/a> for a lite version of WordPress that I've been thinking about for a long time, called Ghost. I think it's fair to say that I didn't quite anticipate how strong the reaction would be - and I've hardly had time to catch my breath in the last 72 hours.\n\nThe response was overwhelming, and overwhelmingly positive. In the first 6 hours my site got 35,000 page views after hitting the number 1 slot on <a href=\"http:\/\/news.ycombinator.com\/item?id=4743245\" onclick=\"javascript:_gaq.push(['_trackEvent','outbound-article','http:\/\/news.ycombinator.com']);\">Hacker News<\/a>.&nbsp;As of right now, the traffic count is just over <a href=\"http:\/\/john.onolan.org\/wp-content\/uploads\/2012\/11\/Screen-Shot-2012-11-09-at-17.51.21.png\" rel=\"lightbox\" class=\"cboxElement\">91,000 page views<\/a>&nbsp;- and Ghost has been featured all over the place. Notable mentions so far include Christina Warren from Mashable, who <a href=\"http:\/\/christina.is\/\" onclick=\"javascript:_gaq.push(['_trackEvent','outbound-article','http:\/\/christina.is']);\">wrote about it<\/a>. Michael Carney from PandoDaily <a href=\"http:\/\/pandodaily.com\/2012\/11\/07\/wordpress-guru-designs-a-concept-blogging-platform-that-doesnt-suck-gets-rave-reviews\/\" onclick=\"javascript:_gaq.push(['_trackEvent','outbound-article','http:\/\/pandodaily.com']);\">interviewed me about it<\/a>. Someone even <a href=\"http:\/\/www.voicens.com\/web\/?p=4425\" onclick=\"javascript:_gaq.push(['_trackEvent','outbound-article','http:\/\/www.voicens.com']);\">wrote about it in Chinese<\/a>. That's pretty cool.\n\n\nThe feedback has been amazing, and while it's impossible to reply to all of the messages individually, I'm getting to as many of them as I can and I want to thank each and every one of you who took the time to send me a message or share the concept because you liked it. Now that the initial storm has died down a bit, I wanted to take some time to answer some of the more common questions and talk about what's next.\n<h2>FAQ - Continued...<\/h2>\n\nThe most common question, bizarrely:\n<h5><em><strong>Oh my god, why is that whole page made of images? What's wrong with you? \/\/ I can't take you seriously \/\/ Don't you know anything about the web? \/\/ You are literally Satan re-incarnate.<\/strong><\/em><\/h5>\n\nThis was really the only negativity I got in response to the post, and it surprised me. I put together the concept page as... just that... a concept. It was a way for me to get the ideas out of my head and \"down on paper\" - or so to speak. I used photoshop as a <em>tool<\/em> to write down my idea with text and images. If I used a sketchbook as a <em>tool&nbsp;<\/em>to create images and handwritten notes, then uploaded scans of it, I doubt anyone would complain. The concept page was never supposed to be a finished product because I had no idea if there would be any interest in it. I had no motivation to waste hours coding a custom layout for something might only ever be read by a few people and then forgotten.\n\nHardware manufacturers make hundreds of foam cutout prototypes of products before they build one with working buttons and screens. I'm aware of all the usability problems with a web page made of images, and equally, foam cutouts without buttons or screens aren't particularly user friendly either. They're not supposed to be.\n\nLet's move on.\n<h5><em><strong>What? Why no comments? I need comments.<\/strong><\/em><\/h5>\n\nBecause comments add a layer of complexity that is beyond the core focus of this platform, which is publishing. Again, that's not to say you couldn't have any comments. This could easily be added with a dedicated plugin where you own the data or (as mentioned) there are third party providers such as Disqus, IntenseDebate, Livefyre and Facebook who all have great platforms. The point of this isn't to say \"you can't have comments\" - it's to say \"comments aren't on by default\". It's about simplic
html: "<p>Three days ago I released a <a title=\"Ghost\" href=\"http:\/\/john.onolan.org\/ghost\/\">concept page<\/a> for a lite version of WordPress that I've been thinking about for a long time, called Ghost. I think it's fair to say that I didn't quite anticipate how strong the reaction would be - and I've hardly had time to catch my breath in the last 72 hours.<\/p>\n<p>The response was overwhelming, and overwhelmingly positive. In the first 6 hours my site got 35,000 page views after hitting the number 1 slot on <a href=\"http:\/\/news.ycombinator.com\/item?id=4743245\" onclick=\"javascript:_gaq.push(['_trackEvent','outbound-article','http:\/\/news.ycombinator.com']);\">Hacker News<\/a>.&nbsp;As of right now, the traffic count is just over <a href=\"http:\/\/john.onolan.org\/wp-content\/uploads\/2012\/11\/Screen-Shot-2012-11-09-at-17.51.21.png\" rel=\"lightbox\" class=\"cboxElement\">91,000 page views<\/a>&nbsp;- and Ghost has been featured all over the place. Notable mentions so far include Christina Warren from Mashable, who <a href=\"http:\/\/christina.is\/\" onclick=\"javascript:_gaq.push(['_trackEvent','outbound-article','http:\/\/christina.is']);\">wrote about it<\/a>. Michael Carney from PandoDaily <a href=\"http:\/\/pandodaily.com\/2012\/11\/07\/wordpress-guru-designs-a-concept-blogging-platform-that-doesnt-suck-gets-rave-reviews\/\" onclick=\"javascript:_gaq.push(['_trackEvent','outbound-article','http:\/\/pandodaily.com']);\">interviewed me about it<\/a>. Someone even <a href=\"http:\/\/www.voicens.com\/web\/?p=4425\" onclick=\"javascript:_gaq.push(['_trackEvent','outbound-article','http:\/\/www.voicens.com']);\">wrote about it in Chinese<\/a>. That's pretty cool.\\n<p>The feedback has been amazing, and while it's impossible to reply to all of the messages individually, I'm getting to as many of them as I can and I want to thank each and every one of you who took the time to send me a message or share the concept because you liked it. Now that the initial storm has died down a bit, I wanted to take some time to answer some of the more common questions and talk about what's next.<\/p>\n<h2>FAQ - Continued...<\/h2>\n<p>The most common question, bizarrely:<\/p>\n<h5><em><strong>Oh my god, why is that whole page made of images? What's wrong with you? \/\/ I can't take you seriously \/\/ Don't you know anything about the web? \/\/ You are literally Satan re-incarnate.<\/strong><\/em><\/h5>\n<p>This was really the only negativity I got in response to the post, and it surprised me. I put together the concept page as... just that... a concept. It was a way for me to get the ideas out of my head and \"down on paper\" - or so to speak. I used photoshop as a <em>tool<\/em> to write down my idea with text and images. If I used a sketchbook as a <em>tool&nbsp;<\/em>to create images and handwritten notes, then uploaded scans of it, I doubt anyone would complain. The concept page was never supposed to be a finished product because I had no idea if there would be any interest in it. I had no motivation to waste hours coding a custom layout for something might only ever be read by a few people and then forgotten.<\/p>\n<p>Hardware manufacturers make hundreds of foam cutout prototypes of products before they build one with working buttons and screens. I'm aware of all the usability problems with a web page made of images, and equally, foam cutouts without buttons or screens aren't particularly user friendly either. They're not supposed to be.<\/p>\n<p>Let's move on.<\/p>\n<h5><em><strong>What? Why no comments? I need comments.<\/strong><\/em><\/h5>\n<p>Because comments add a layer of complexity that is beyond the core focus of this platform, which is publishing. Again, that's not to say you couldn't have any comments. This could easily be added with a dedicated plugin where you own the data or (as mentioned) there are third party providers such as Disqus, IntenseDebate, Livefyre and Facebook who all have great platforms. The point of this isn't to say \"you can't have comments\" - it's to say \"comments aren't
image: 'ghostpost.jpg',
status: status,
language: language
});
}
function createUser(overrides) {
return _.defaults(overrides, {
uuid: uuid.v4(),
status: 'active',
created_by: 1,
created_at: new Date()
});
}
function createGenericUser(uniqueInteger) {
return createUser({
name: 'Joe Bloggs',
slug: 'joe-blogs',
email: 'joe_' + uniqueInteger + '@example.com',
password: '$2a$10$.pZeeBE0gHXd0PTnbT/ph.GEKgd0Wd3q2pWna3ynTGBkPKnGIKZL6'
});
}
function createPostsTags(postId, tagId) {
return {
post_id: postId,
tag_id: tagId
};
}
function createAppField(overrides) {
return _.defaults(overrides, {
uuid: uuid.v4(),
created_by: 1,
created_at: new Date(),
active: true,
app_id: 1,
relatable_id: 1,
relatable_type: 'posts'
});
}
function createAppSetting(overrides) {
return _.defaults(overrides, {
uuid: uuid.v4(),
app_id: 1,
created_by: 1,
created_at: new Date()
});
}
posts = [
createPost(DataGenerator.Content.posts[0]),
createPost(DataGenerator.Content.posts[1]),
createPost(DataGenerator.Content.posts[2]),
createPost(DataGenerator.Content.posts[3]),
createPost(DataGenerator.Content.posts[4]),
createPost(DataGenerator.Content.posts[5]),
createPost(DataGenerator.Content.posts[6])
];
tags = [
createBasic(DataGenerator.Content.tags[0]),
createBasic(DataGenerator.Content.tags[1]),
createBasic(DataGenerator.Content.tags[2]),
createBasic(DataGenerator.Content.tags[3]),
createBasic(DataGenerator.Content.tags[4])
];
roles = [
createBasic(DataGenerator.Content.roles[0]),
createBasic(DataGenerator.Content.roles[1]),
createBasic(DataGenerator.Content.roles[2]),
createBasic(DataGenerator.Content.roles[3]),
];
users = [
createUser(DataGenerator.Content.users[0]),
createUser(DataGenerator.Content.users[1]),
createUser(DataGenerator.Content.users[2]),
createUser(DataGenerator.Content.users[3]),
];
roles_users = [
{ user_id: 1, role_id: 4},
{ user_id: 2, role_id: 1},
{ user_id: 3, role_id: 2},
{ user_id: 4, role_id: 3}
];
posts_tags = [
{ post_id: 1, tag_id: 1 },
{ post_id: 1, tag_id: 2 },
{ post_id: 2, tag_id: 1 },
{ post_id: 2, tag_id: 2 },
{ post_id: 3, tag_id: 3 },
{ post_id: 4, tag_id: 4 }
];
apps = [
createBasic(DataGenerator.Content.apps[0]),
createBasic(DataGenerator.Content.apps[1]),
createBasic(DataGenerator.Content.apps[2])
];
app_fields = [
createAppField(DataGenerator.Content.app_fields[0]),
createAppField(DataGenerator.Content.app_fields[1])
];
return {
createPost: createPost,
createGenericPost: createGenericPost,
createTag: createBasic,
createUser: createUser,
createGenericUser: createGenericUser,
createBasic: createBasic,
createRole: createBasic,
createPermission: createBasic,
createPostsTags: createPostsTags,
createApp: createBasic,
createAppField: createAppField,
createAppSetting: createAppSetting,
posts: posts,
tags: tags,
posts_tags: posts_tags,
apps: apps,
app_fields: app_fields,
roles: roles,
users: users,
roles_users: roles_users
};
}());
DataGenerator.forModel = (function () {
var posts,
tags,
2014-07-29 09:05:13 +04:00
users,
roles;
posts = _.map(DataGenerator.Content.posts, function (post) {
return _.pick(post, 'title', 'markdown');
});
tags = DataGenerator.Content.tags;
users = _.map(DataGenerator.Content.users, function (user) {
user = _.pick(user, 'name', 'email');
return _.defaults({
password: 'Sl1m3rson'
}, user);
});
2014-07-29 09:05:13 +04:00
roles = _.map(DataGenerator.Content.roles, function (role, id) {
return _.extend({}, role, {id: id + 1});
});
return {
posts: posts,
tags: tags,
2014-07-29 09:05:13 +04:00
users: users,
roles: roles
};
}());
2013-11-18 04:34:02 +04:00
module.exports = DataGenerator;