Skip to content

Commit

Permalink
add slightly more authorized/unauthorized tests
Browse files Browse the repository at this point in the history
This affects the POST to /entries/preview.
  • Loading branch information
bewest committed Aug 8, 2016
1 parent 980112c commit c2ff306
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/api.entries.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,13 @@ describe('Entries REST api', function ( ) {
});
});

it('/entries/preview', function (done) {
it('disallow POST by readable /entries/preview', function (done) {
request(this.app)
.post('/entries/preview.json')
.send(load('json'))
.expect(201)
.expect(401)
.end(function (err, res) {
res.body.should.be.instanceof(Array).and.have.lengthOf(30);
// res.body.should.be.instanceof(Array).and.have.lengthOf(30);
done();
});
});
Expand Down
13 changes: 13 additions & 0 deletions tests/api.unauthorized.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ describe('authed REST api', function ( ) {
});
});

it('/entries/preview', function (done) {
var known_key = this.known_key;
request(this.app)
.post('/entries/preview.json')
.set('api-secret', known_key)
.send(load('json'))
.expect(201)
.end(function (err, res) {
res.body.should.be.instanceof(Array).and.have.lengthOf(30);
done();
});
});

it('allow authorized POST', function (done) {
var app = this.app;
var known_key = this.known_key;
Expand Down

0 comments on commit c2ff306

Please sign in to comment.