Skip to content

Commit 12e19e3

Browse files
author
Raymond Feng
committed
Upgrade test fixtures to use LB 2.x layout
1 parent 5158df8 commit 12e19e3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+495
-389
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"karma-mocha": "^0.1.10",
8080
"karma-phantomjs-launcher": "^0.1.4",
8181
"karma-script-launcher": "^0.1.0",
82-
"loopback-boot": "^1.1.0",
82+
"loopback-boot": "^2.7.0",
8383
"loopback-datasource-juggler": "^2.19.1",
8484
"loopback-testing": "^1.1.0",
8585
"mocha": "^2.1.0",

test/access-control.integration.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var loopback = require('../');
44
var lt = require('loopback-testing');
55
var path = require('path');
66
var ACCESS_CONTROL_APP = path.join(__dirname, 'fixtures', 'access-control');
7-
var app = require(path.join(ACCESS_CONTROL_APP, 'app.js'));
7+
var app = require(path.join(ACCESS_CONTROL_APP, 'server/server.js'));
88
var assert = require('assert');
99
var USER = {email: '[email protected]', password: 'test'};
1010
var CURRENT_USER = {email: '[email protected]', password: 'test'};

test/access-token.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
var loopback = require('../');
22
var extend = require('util')._extend;
33
var Token = loopback.AccessToken.extend('MyToken');
4+
var ds = loopback.createDataSource({connector: loopback.Memory});
5+
Token.attachTo(ds);
46
var ACL = loopback.ACL;
57

68
describe('loopback.token(options)', function() {

test/fixtures/access-control/app.json

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "accessToken",
3+
"base": "AccessToken",
4+
"baseUrl": "access-tokens",
5+
"acls": [
6+
{
7+
"accessType": "*",
8+
"permission": "DENY",
9+
"principalType": "ROLE",
10+
"principalId": "$everyone"
11+
},
12+
{
13+
"permission": "ALLOW",
14+
"principalType": "ROLE",
15+
"principalId": "$everyone",
16+
"property": "create"
17+
}
18+
]
19+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"name": "account",
3+
"relations": {
4+
"transactions": {
5+
"model": "transaction",
6+
"type": "hasMany"
7+
},
8+
"user": {
9+
"model": "user",
10+
"type": "belongsTo",
11+
"foreignKey": "userId"
12+
}
13+
},
14+
"acls": [
15+
{
16+
"accessType": "*",
17+
"permission": "DENY",
18+
"principalType": "ROLE",
19+
"principalId": "$everyone"
20+
},
21+
{
22+
"accessType": "*",
23+
"permission": "ALLOW",
24+
"principalType": "ROLE",
25+
"principalId": "$owner"
26+
},
27+
{
28+
"permission": "DENY",
29+
"principalType": "ROLE",
30+
"principalId": "$owner",
31+
"property": "deleteById"
32+
},
33+
{
34+
"accessType": "*",
35+
"permission": "DENY",
36+
"property": "find",
37+
"principalType": "ROLE",
38+
"principalId": "$dummy"
39+
}
40+
],
41+
"properties": {}
42+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "alert",
3+
"acls": [
4+
{
5+
"accessType": "WRITE",
6+
"permission": "DENY",
7+
"principalType": "ROLE",
8+
"principalId": "$everyone"
9+
}
10+
],
11+
"properties": {}
12+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "bank",
3+
"relations": {
4+
"users": {
5+
"model": "user",
6+
"type": "hasMany"
7+
},
8+
"accounts": {
9+
"model": "account",
10+
"type": "hasMany"
11+
}
12+
},
13+
"acls": [
14+
{
15+
"accessType": "*",
16+
"permission": "DENY",
17+
"principalType": "ROLE",
18+
"principalId": "$everyone"
19+
},
20+
{
21+
"accessType": "READ",
22+
"permission": "ALLOW",
23+
"principalType": "ROLE",
24+
"principalId": "$everyone"
25+
}
26+
],
27+
"properties": {}
28+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "email",
3+
"base": "Email",
4+
"acls": [
5+
{
6+
"accessType": "*",
7+
"permission": "DENY",
8+
"principalType": "ROLE",
9+
"principalId": "$everyone"
10+
}
11+
]
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "transaction",
3+
"acls": [
4+
{
5+
"accessType": "*",
6+
"permission": "DENY",
7+
"principalType": "ROLE",
8+
"principalId": "$everyone"
9+
}
10+
],
11+
"properties": {}
12+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "user",
3+
"base": "User",
4+
"relations": {
5+
"accessTokens": {
6+
"model": "accessToken",
7+
"type": "hasMany",
8+
"foreignKey": "userId"
9+
},
10+
"transactions": {
11+
"model": "transaction",
12+
"type": "hasMany"
13+
}
14+
},
15+
"acls": [
16+
{
17+
"accessType": "*",
18+
"permission": "DENY",
19+
"principalType": "ROLE",
20+
"principalId": "$everyone"
21+
}
22+
]
23+
}

test/fixtures/access-control/models.json

Lines changed: 0 additions & 171 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"port": 3000,
3+
"host": "0.0.0.0",
4+
"legacyExplorer": false
5+
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
{
22
"db": {
3-
"defaultForType": "db",
43
"connector": "memory"
54
},
65
"mail": {
7-
"defaultForType": "mail",
86
"connector": "mail"
97
}
108
}

0 commit comments

Comments
 (0)