Merge pull request #317 from strongloop/feature/improve-access-checks
Improve access checks tests
This commit is contained in:
commit
ee1dfc8e4f
|
@ -48,11 +48,11 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"loopback-datasource-juggler": ">=1.4.0 <1.6.0",
|
"loopback-datasource-juggler": ">=1.4.0 <1.6.0",
|
||||||
"mocha": "~1.18.0",
|
"mocha": "~1.20.1",
|
||||||
"strong-task-emitter": "0.0.x",
|
"strong-task-emitter": "0.0.x",
|
||||||
"supertest": "~0.12.1",
|
"supertest": "~0.12.1",
|
||||||
"chai": "~1.9.1",
|
"chai": "~1.9.1",
|
||||||
"loopback-testing": "~0.1.2",
|
"loopback-testing": "~0.2.0",
|
||||||
"browserify": "~4.1.5",
|
"browserify": "~4.1.5",
|
||||||
"grunt": "~0.4.5",
|
"grunt": "~0.4.5",
|
||||||
"grunt-browserify": "~2.1.0",
|
"grunt-browserify": "~2.1.0",
|
||||||
|
|
|
@ -69,8 +69,11 @@ describe('access control - integration', function () {
|
||||||
lt.it.shouldBeDeniedWhenCalledUnauthenticated('GET', urlForUser);
|
lt.it.shouldBeDeniedWhenCalledUnauthenticated('GET', urlForUser);
|
||||||
lt.it.shouldBeDeniedWhenCalledByUser(CURRENT_USER,'GET', urlForUser);
|
lt.it.shouldBeDeniedWhenCalledByUser(CURRENT_USER,'GET', urlForUser);
|
||||||
|
|
||||||
lt.it.shouldBeAllowedWhenCalledAnonymously('POST', '/api/users');
|
lt.it.shouldBeAllowedWhenCalledAnonymously(
|
||||||
lt.it.shouldBeAllowedWhenCalledByUser(CURRENT_USER, 'POST', '/api/users');
|
'POST', '/api/users', newUserData());
|
||||||
|
|
||||||
|
lt.it.shouldBeAllowedWhenCalledByUser(
|
||||||
|
CURRENT_USER, 'POST', '/api/users', newUserData());
|
||||||
|
|
||||||
lt.it.shouldBeAllowedWhenCalledByUser(CURRENT_USER, 'POST', '/api/users/logout');
|
lt.it.shouldBeAllowedWhenCalledByUser(CURRENT_USER, 'POST', '/api/users/logout');
|
||||||
|
|
||||||
|
@ -112,6 +115,15 @@ describe('access control - integration', function () {
|
||||||
function urlForUser() {
|
function urlForUser() {
|
||||||
return '/api/users/' + this.randomUser.id;
|
return '/api/users/' + this.randomUser.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var userCounter;
|
||||||
|
function newUserData() {
|
||||||
|
userCounter = userCounter ? ++userCounter : 1;
|
||||||
|
return {
|
||||||
|
email: 'new-' + userCounter + '@test.test',
|
||||||
|
password: 'test'
|
||||||
|
};
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('/banks', function () {
|
describe('/banks', function () {
|
||||||
|
|
Loading…
Reference in New Issue