Merge pull request #317 from strongloop/feature/improve-access-checks

Improve access checks tests
This commit is contained in:
Miroslav Bajtoš 2014-06-12 10:39:09 +02:00
commit ee1dfc8e4f
2 changed files with 16 additions and 4 deletions

View File

@ -48,11 +48,11 @@
},
"devDependencies": {
"loopback-datasource-juggler": ">=1.4.0 <1.6.0",
"mocha": "~1.18.0",
"mocha": "~1.20.1",
"strong-task-emitter": "0.0.x",
"supertest": "~0.12.1",
"chai": "~1.9.1",
"loopback-testing": "~0.1.2",
"loopback-testing": "~0.2.0",
"browserify": "~4.1.5",
"grunt": "~0.4.5",
"grunt-browserify": "~2.1.0",

View File

@ -69,8 +69,11 @@ describe('access control - integration', function () {
lt.it.shouldBeDeniedWhenCalledUnauthenticated('GET', urlForUser);
lt.it.shouldBeDeniedWhenCalledByUser(CURRENT_USER,'GET', urlForUser);
lt.it.shouldBeAllowedWhenCalledAnonymously('POST', '/api/users');
lt.it.shouldBeAllowedWhenCalledByUser(CURRENT_USER, 'POST', '/api/users');
lt.it.shouldBeAllowedWhenCalledAnonymously(
'POST', '/api/users', newUserData());
lt.it.shouldBeAllowedWhenCalledByUser(
CURRENT_USER, 'POST', '/api/users', newUserData());
lt.it.shouldBeAllowedWhenCalledByUser(CURRENT_USER, 'POST', '/api/users/logout');
@ -112,6 +115,15 @@ describe('access control - integration', function () {
function urlForUser() {
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 () {