Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tjwebb committed Sep 25, 2015
1 parent 98e4087 commit 326183d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 38 deletions.
7 changes: 6 additions & 1 deletion config/fixtures/permission.js
Expand Up @@ -20,7 +20,7 @@ var modelRestrictions = {
registered: [
'Role',
'Permission',
//'User',
'User',
'Passport'
],
public: [
Expand Down Expand Up @@ -79,6 +79,11 @@ function grantRegisteredPermissions (roles, models, admin) {
action: 'read',
role: registeredRole.id
},
{
model: _.find(models, { name: 'User' }).id,
action: 'read',
role: registeredRole.id
},
{
model: _.find(models, { name: 'User' }).id,
action: 'update',
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -4,7 +4,7 @@
"description": "Comprehensive user permissions and entitlements system for sails.js and Waterline. Supports user authentication with passport.js, role-based permissioning, object ownership, and row-level security.",
"main": "dist/api/hooks/permissions/index.js",
"scripts": {
"test": "mocha --reporter spec --compilers js:babel/register",
"test": "gulp && mocha --reporter spec --compilers js:babel/register",
"prepublish": "gulp"
},
"repository": {
Expand Down Expand Up @@ -44,7 +44,7 @@
"mocha": "^2.x.x",
"request": "^2.58.0",
"sails": "balderdashy/sails",
"sails-auth": "latest",
"sails-auth": "^2.0",
"sails-memory": "^0.10.5",
"supertest": "^0.15.0",
"waterline-postgresql": "^0.12.0"
Expand Down
35 changes: 0 additions & 35 deletions test/unit/controllers/UserController.test.js
Expand Up @@ -477,41 +477,6 @@ describe('User Controller', function() {
});


it('should not be able to read another user', function(done) {

request(sails.hooks.http.app)
.get('/user/' + adminUserId)
.set('Authorization', registeredAuth.Authorization)
.expect(403)
.end(function(err, res) {
var user = res.body;

assert.ifError(err);
assert(_.isString(user.error), JSON.stringify(user));

done(err);

});

});

it('should not be able to read all users', function(done) {

request(sails.hooks.http.app)
.get('/user/')
.set('Authorization', registeredAuth.Authorization)
.expect(200)
.end(function(err, res) {
var users = res.body;

assert.ifError(err);
assert(users.length == 1);

done(err);

});

});

});

Expand Down

0 comments on commit 326183d

Please sign in to comment.