mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-03 00:15:11 +03:00
Added acceptance tests for private blogging
- Test that the basic routes are working
This commit is contained in:
parent
297c773f2a
commit
e106c6dc1c
@ -36,16 +36,6 @@ describe('Default Frontend routing', function () {
|
||||
};
|
||||
}
|
||||
|
||||
function addPosts(done) {
|
||||
testUtils.clearData().then(function () {
|
||||
return testUtils.initData();
|
||||
}).then(function () {
|
||||
return testUtils.fixtures.insertPostsAndTags();
|
||||
}).then(function () {
|
||||
done();
|
||||
});
|
||||
}
|
||||
|
||||
afterEach(function () {
|
||||
sinon.restore();
|
||||
});
|
||||
@ -404,4 +394,40 @@ describe('Default Frontend routing', function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Private Blogging', function () {
|
||||
beforeEach(function () {
|
||||
sinon.stub(settingsCache, 'get').callsFake(function (key, options) {
|
||||
if (key === 'is_private') {
|
||||
return true;
|
||||
}
|
||||
return origCache.get(key, options);
|
||||
});
|
||||
});
|
||||
|
||||
it('/ should redirect to /private/', function (done) {
|
||||
request.get('/')
|
||||
.expect('Location', '/private/?r=%2F')
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
|
||||
it('/welcome/ should redirect to /private/', function (done) {
|
||||
request.get('/welcome/')
|
||||
.expect('Location', '/private/?r=%2Fwelcome%2F')
|
||||
.expect(302)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
|
||||
it('should still serve private RSS feed', function (done) {
|
||||
request.get(`/${settingsCache.get('public_hash')}/rss/`)
|
||||
.expect(200)
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect('Content-Type', 'text/xml; charset=utf-8')
|
||||
.end(function (err, res) {
|
||||
res.text.should.match(/<!\[CDATA\[Welcome to Ghost\]\]>/);
|
||||
doEnd(done)(err, res);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user