1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-20 05:39:42 +02:00

Move mirage server create to module-for-acceptance tests file

This commit is contained in:
zinyando 2016-07-19 15:50:29 +02:00
parent a74b14ae76
commit 68271646eb
5 changed files with 296 additions and 70 deletions

View file

@ -32,33 +32,7 @@ export default function () {
let folder_id = request.queryParams.folder;
if (folder_id = "VzMuyEw_3WqiafcG") {
return [{
"id": "VzMwX0w_3WrtFztd",
"created": "2016-05-11T13:15:11Z",
"revised": "2016-05-11T13:22:16Z",
"orgId": "VzMuyEw_3WqiafcD",
"folderId": "VzMuyEw_3WqiafcG",
"userId": "VzMuyEw_3WqiafcE",
"job": "",
"location": "template-0",
"name": "Empty Document",
"excerpt": "My test document",
"tags": "",
"template": false
}, {
"id": "VzMvJEw_3WqiafcI",
"created": "2016-05-11T13:09:56Z",
"revised": "2016-05-11T13:09:56Z",
"orgId": "VzMuyEw_3WqiafcD",
"folderId": "VzMuyEw_3WqiafcG",
"userId": "VzMuyEw_3WqiafcE",
"job": "0bf9b076-cb74-4e8e-75be-8ee2d24a8171",
"location": "/var/folders/d6/kr81d2fs5bsbm8rz2p092fy80000gn/T/documize/_uploads/0bf9b076-cb74-4e8e-75be-8ee2d24a8171/README.md",
"name": "README",
"excerpt": "To Document/ Instructions. GO. go- bindata- assetsfs. SSL.",
"tags": "",
"template": false
}];
return schema.db.documents.where({ folderId: folder_id });
}
if (folder_id = "VzMygEw_3WrtFzto") {
@ -78,6 +52,228 @@ export default function () {
}
});
this.get('/documents/:id', function () {
return {
"id": "VzMzBUw_3WrtFztv",
"created": "2016-05-11T13:26:29Z",
"revised": "2016-05-11T13:26:29Z",
"orgId": "VzMuyEw_3WqiafcD",
"folderId": "VzMygEw_3WrtFzto",
"userId": "VzMuyEw_3WqiafcE",
"job": "3004c449-b053-49a6-4abc-72688136184d",
"location": "/var/folders/d6/kr81d2fs5bsbm8rz2p092fy80000gn/T/documize/_uploads/3004c449-b053-49a6-4abc-72688136184d/README.md",
"name": "README",
"excerpt": "To Document/ Instructions. GO. go- bindata- assetsfs. SSL.",
"tags": "",
"template": false
};
});
this.get('/documents/:id/pages', function () {
return [{
"id": "VzMzBUw_3WrtFztw",
"created": "2016-05-11T13:26:29Z",
"revised": "2016-05-11T13:26:29Z",
"orgId": "VzMuyEw_3WqiafcD",
"documentId": "VzMzBUw_3WrtFztv",
"userId": "VzMuyEw_3WqiafcE",
"contentType": "wysiwyg",
"level": 1,
"sequence": 1024,
"title": "README",
"body": "",
"revisions": 0
}, {
"id": "VzMzBUw_3WrtFztx",
"created": "2016-05-11T13:26:29Z",
"revised": "2016-05-11T13:26:29Z",
"orgId": "VzMuyEw_3WqiafcD",
"documentId": "VzMzBUw_3WrtFztv",
"userId": "VzMuyEw_3WqiafcE",
"contentType": "wysiwyg",
"level": 2,
"sequence": 2048,
"title": "To Document / Instructions ",
"body": "\n\n\u003cp\u003eThe build process around go get github.com/elazarl/go-bindata-assetfs\u003c/p\u003e\n\n",
"revisions": 0
}, {
"id": "VzMzBUw_3WrtFzty",
"created": "2016-05-11T13:26:29Z",
"revised": "2016-05-11T13:26:29Z",
"orgId": "VzMuyEw_3WqiafcD",
"documentId": "VzMzBUw_3WrtFztv",
"userId": "VzMuyEw_3WqiafcE",
"contentType": "wysiwyg",
"level": 3,
"sequence": 3072,
"title": "GO ",
"body": "\n\n\u003cp\u003egobin / go env\u003c/p\u003e\n\n",
"revisions": 0
}, {
"id": "VzMzBUw_3WrtFztz",
"created": "2016-05-11T13:26:29Z",
"revised": "2016-05-11T13:26:29Z",
"orgId": "VzMuyEw_3WqiafcD",
"documentId": "VzMzBUw_3WrtFztv",
"userId": "VzMuyEw_3WqiafcE",
"contentType": "wysiwyg",
"level": 3,
"sequence": 4096,
"title": "go-bindata-assetsfs ",
"body": "\n\n\u003cp\u003emake sure you do install cmd from inside go-* folder where main.go lives\u003c/p\u003e\n\n",
"revisions": 0
}, {
"id": "VzMzBUw_3WrtFzt0",
"created": "2016-05-11T13:26:29Z",
"revised": "2016-05-11T13:26:29Z",
"orgId": "VzMuyEw_3WqiafcD",
"documentId": "VzMzBUw_3WrtFztv",
"userId": "VzMuyEw_3WqiafcE",
"contentType": "wysiwyg",
"level": 3,
"sequence": 5120,
"title": "SSL ",
"body": "\n\n\u003cp\u003eselfcert generation and avoiding red lock\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://www.accuweaver.com/2014/09/19/make-chrome-accept-a-self-signed-certificate-on-osx/\"\u003ehttps://www.accuweaver.com/2014/09/19/make-chrome-accept-a-self-signed-certificate-on-osx/\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003echrome://restart\u003c/p\u003e\n\n\u003cp\u003ego run generate_cert.go -host demo1.dev\u003c/p\u003e\n\n\u003cp\u003eport number not required\nbut browser restart is!\u003c/p\u003e\n\n",
"revisions": 0
}, {
"id": "VzMzBUw_3WrtFzt1",
"created": "2016-05-11T13:26:29Z",
"revised": "2016-05-11T13:26:29Z",
"orgId": "VzMuyEw_3WqiafcD",
"documentId": "VzMzBUw_3WrtFztv",
"userId": "VzMuyEw_3WqiafcE",
"contentType": "wysiwyg",
"level": 3,
"sequence": 6144,
"title": "after clone ",
"body": "\n\n\u003cul\u003e\n\u003cli\u003ecd app\u003c/li\u003e\n\u003cli\u003enpm install\u003c/li\u003e\n\u003cli\u003ebower install\u003c/li\u003e\n\u003cli\u003ecd ..\u003c/li\u003e\n\u003cli\u003e./build.sh\u003c/li\u003e\n\u003c/ul\u003e\n",
"revisions": 0
}, {
"id": "V1qnNUw_3QRDs13j",
"created": "2016-06-10T11:40:37Z",
"revised": "2016-06-10T11:40:37Z",
"orgId": "VzMuyEw_3WqiafcD",
"documentId": "VzMzBUw_3WrtFztv",
"userId": "VzMuyEw_3WqiafcE",
"contentType": "github",
"level": 2,
"sequence": 12288,
"title": "GitHub Section",
"body": "\n\u003cdiv class=\"section-github-render\"\u003e\n\t\u003cp\u003eThere are 0 commits for branch \u003ca href=\"\"\u003e\u003c/a\u003e of repository \u003ca href=\"\"\u003e.\u003c/a\u003e\u003c/p\u003e\n\t\u003cdiv class=\"github-board\"\u003e\n\t\t\n\t\u003c/div\u003e\n\u003c/div\u003e\n",
"revisions": 0
}, {
"id": "V1qqJkw_3RXs3w1D",
"created": "2016-06-10T11:53:10Z",
"revised": "2016-06-10T11:53:10Z",
"orgId": "VzMuyEw_3WqiafcD",
"documentId": "VzMzBUw_3WrtFztv",
"userId": "VzMuyEw_3WqiafcE",
"contentType": "github",
"level": 2,
"sequence": 24576,
"title": "GitHub Section",
"body": "\n\u003cdiv class=\"section-github-render\"\u003e\n\t\u003cp\u003eThere are 0 commits for branch \u003ca href=\"\"\u003e\u003c/a\u003e of repository \u003ca href=\"\"\u003e.\u003c/a\u003e\u003c/p\u003e\n\t\u003cdiv class=\"github-board\"\u003e\n\t\t\n\t\u003c/div\u003e\n\u003c/div\u003e\n",
"revisions": 0
}];
});
this.post('/templates/0/folder/VzMuyEw_3WqiafcG', function (schema, request) {
let type = request.queryParams.type;
if (type === 'saved') {
return schema.db.documents.insert({
"id": "V4y7jkw_3QvCDSeS",
"created": "2016-07-18T11:20:47Z",
"revised": "2016-07-18T11:20:47Z",
"orgId": "VzMuyEw_3WqiafcD",
"folderId": "VzMuyEw_3WqiafcG",
"userId": "VzMuyEw_3WqiafcE",
"job": "",
"location": "template-0",
"name": "New Document",
"excerpt": "A new document",
"tags": "",
"template": false
});
}
});
this.delete('/documents/:id', function (schema, request) {
let id = request.params.id;
return schema.db.documents.remove(id);
});
this.get('/documents/:id/attachments', function () {
return {};
});
this.get('/documents/:id/meta', function () {
return {
"viewers": [{
"userId": "VzMuyEw_3WqiafcE",
"created": "2016-07-14T13:46:24Z",
"firstname": "Lennex",
"lastname": "Zinyando"
}],
"editors": [{
"pageId": "V1qqJkw_3RXs3w1D",
"userId": "VzMuyEw_3WqiafcE",
"action": "add-page",
"created": "2016-06-10T11:53:10Z",
"firstname": "Lennex",
"lastname": "Zinyando"
}, {
"pageId": "V1qnNUw_3QRDs13j",
"userId": "VzMuyEw_3WqiafcE",
"action": "add-page",
"created": "2016-06-10T11:40:37Z",
"firstname": "Lennex",
"lastname": "Zinyando"
}, {
"pageId": "VzMzBUw_3WrtFztw",
"userId": "VzMuyEw_3WqiafcE",
"action": "add-page",
"created": "2016-05-11T13:26:29Z",
"firstname": "Lennex",
"lastname": "Zinyando"
}, {
"pageId": "VzMzBUw_3WrtFztx",
"userId": "VzMuyEw_3WqiafcE",
"action": "add-page",
"created": "2016-05-11T13:26:29Z",
"firstname": "Lennex",
"lastname": "Zinyando"
}, {
"pageId": "VzMzBUw_3WrtFzty",
"userId": "VzMuyEw_3WqiafcE",
"action": "add-page",
"created": "2016-05-11T13:26:29Z",
"firstname": "Lennex",
"lastname": "Zinyando"
}, {
"pageId": "VzMzBUw_3WrtFztz",
"userId": "VzMuyEw_3WqiafcE",
"action": "add-page",
"created": "2016-05-11T13:26:29Z",
"firstname": "Lennex",
"lastname": "Zinyando"
}, {
"pageId": "VzMzBUw_3WrtFzt0",
"userId": "VzMuyEw_3WqiafcE",
"action": "add-page",
"created": "2016-05-11T13:26:29Z",
"firstname": "Lennex",
"lastname": "Zinyando"
}, {
"pageId": "VzMzBUw_3WrtFzt1",
"userId": "VzMuyEw_3WqiafcE",
"action": "add-page",
"created": "2016-05-11T13:26:29Z",
"firstname": "Lennex",
"lastname": "Zinyando"
}]
};
});
this.get('/folders', function (schema) {
return schema.db.folders;
});
@ -137,6 +333,29 @@ export default function () {
// return schema.db.folderPermissions.update('VzMygEw_3WrtFzto', attrs[0]);
});
this.get('/users/folder/:id', () => {
return [{
"id": "VzMuyEw_3WqiafcE",
"created": "2016-05-11T15:08:24Z",
"revised": "2016-07-04T10:24:41Z",
"firstname": "Lennex",
"lastname": "Zinyando",
"email": "brizdigital@gmail.com",
"initials": "LZ",
"active": true,
"editor": false,
"admin": false,
"accounts": null
}];
});
this.get('/sections/refresh', (schema, request) => {
let documentID = request.queryParams.documentID;
if (documentID) {
return {};
}
});
this.put('/folders/:id', (schema, request) => {
let id = request.params.id;
let attrs = JSON.parse(request.requestBody);

View file

@ -32,7 +32,8 @@
"waitToAppear",
"stubUserNotification",
"is",
"authenticateUser"
"authenticateUser",
"localStorage"
],
"node": false,
"browser": false,

View file

@ -6,8 +6,15 @@ export default function(name, options = {}) {
module(name, {
beforeEach() {
this.application = startApp();
localStorage.setItem('folder', 'VzMuyEw_3WqiafcG');
stubAudit(this);
stubUserNotification(this);
server.createList('folder', 2);
server.createList('user', 2);
server.createList('document', 2);
server.createList('permission', 4);
server.createList('folder-permission', 2);
server.createList('organization', 1);
if (options.beforeEach) {
options.beforeEach.apply(this, arguments);

View file

@ -10,16 +10,15 @@
<meta property="dbname" content="{{.DBname}}" />
<meta property="dbhash" content="{{.DBhash}}" />
<meta name="author" content="Documize" />
<style>
#ember-testing-container, #ember-testing-container * {
#ember-testing {
zoom: 100% !important;
}
#ember-testing-container {
/* Set position static to short-circuit Hubspot Tether's positioning */
/* https://github.com/HubSpot/tether/pull/98/ */
position: static !important;
}
.tether-container * {
z-index: 9999;
}
</style>
{{content-for "head"}}