test: fix ACL integration tests
Change the tests creating new users so that they send valid user data, in order to prevent 422 "validation failed" responses. Upgrade loopback-testing to 0.2.0.
This commit is contained in:
parent
ad347e517c
commit
3deadcd180
|
@ -52,7 +52,7 @@
|
|||
"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",
|
||||
|
|
|
@ -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 () {
|
||||
|
|
Loading…
Reference in New Issue