Skip to content

Commit

Permalink
Add functional tests for new auth behavior in users/name api
Browse files Browse the repository at this point in the history
  • Loading branch information
javierbrea committed Sep 15, 2018
1 parent a047651 commit 410c3a6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/functional/specs/users-api.specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,25 @@ test.describe('users api', function () {
})

test.describe('get user', () => {
test.it('should return a forbidden error', () => {
test.it('should return a forbidden error if user is different to himself', () => {
return getUser(newUser.name).then(response => {
return Promise.all([
test.expect(response.body.message).to.contain('Not authorized'),
test.expect(response.statusCode).to.equal(403)
])
})
})

test.it('should return user data if user is himself', () => {
return getUser(user.name).then(response => {
return Promise.all([
test.expect(response.body.name).to.equal(user.name),
test.expect(response.body.email).to.equal(user.email),
test.expect(response.body.role).to.equal(user.role),
test.expect(response.statusCode).to.equal(200)
])
})
})
})
})
}
Expand Down

0 comments on commit 410c3a6

Please sign in to comment.