mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
closes #5872
This commit is contained in:
@@ -1232,6 +1232,15 @@ describe('Controllers', function () {
|
||||
});
|
||||
|
||||
describe('post redirect', function () {
|
||||
var jar;
|
||||
before(function (done) {
|
||||
helpers.loginUser('foo', 'barbar', function (err, _jar) {
|
||||
assert.ifError(err);
|
||||
jar = _jar;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should 404 for invalid pid', function (done) {
|
||||
request(nconf.get('url') + '/api/post/fail', function (err, res) {
|
||||
assert.ifError(err);
|
||||
@@ -1240,6 +1249,17 @@ describe('Controllers', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('should 403 if user does not have read privilege', function (done) {
|
||||
privileges.categories.rescind(['read'], category.cid, 'registered-users', function (err) {
|
||||
assert.ifError(err);
|
||||
request(nconf.get('url') + '/api/post/' + pid, { jar: jar }, function (err, res) {
|
||||
assert.ifError(err);
|
||||
assert.equal(res.statusCode, 403);
|
||||
privileges.categories.give(['read'], category.cid, 'registered-users', done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should return correct post path', function (done) {
|
||||
request(nconf.get('url') + '/api/post/' + pid, { json: true }, function (err, res, body) {
|
||||
assert.ifError(err);
|
||||
|
||||
Reference in New Issue
Block a user