From ee6fa829d569f5b06289db36443e437b428cc7cb Mon Sep 17 00:00:00 2001 From: Cian Foley Date: Fri, 6 Apr 2018 12:18:10 +0100 Subject: [PATCH] test to get coverage back to 100 --- .../test/endToEnd/policies.test.js | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/packages/udaru-hapi-16-plugin/test/endToEnd/policies.test.js b/packages/udaru-hapi-16-plugin/test/endToEnd/policies.test.js index 59050a54..59df74f0 100644 --- a/packages/udaru-hapi-16-plugin/test/endToEnd/policies.test.js +++ b/packages/udaru-hapi-16-plugin/test/endToEnd/policies.test.js @@ -46,6 +46,22 @@ lab.experiment('Policies - get/list', () => { }) }) + lab.test('search policy: error handling', (done) => { + const options = utils.requestOptions({ + method: 'GET', + url: '/authorization/policies/search?query=acc' + }) + + const stub = sinon.stub(server.udaru.policies, 'search').yields(new Error('ERROR')) + + server.inject(options, (response) => { + stub.restore() + + expect(response.statusCode).to.equal(500) + done() + }) + }) + lab.test('search shared policies', (done) => { const options = utils.requestOptions({ method: 'GET', @@ -59,6 +75,22 @@ lab.experiment('Policies - get/list', () => { }) }) + lab.test('search policy: error handling', (done) => { + const options = utils.requestOptions({ + method: 'GET', + url: '/authorization/shared-policies/search?query=pol' + }) + + const stub = sinon.stub(server.udaru.policies, 'search').yields(new Error('ERROR')) + + server.inject(options, (response) => { + stub.restore() + + expect(response.statusCode).to.equal(500) + done() + }) + }) + lab.test('get policy list: limit', (done) => { const options = utils.requestOptions({ method: 'GET',