This is an automated email from the ASF dual-hosted git repository. csantanapr pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-client-js.git
The following commit(s) were added to refs/heads/master by this push: new 784df05 Support retrieving status and configuration of feed triggers (#80) 784df05 is described below commit 784df0587b8b453738468d6b3b298a8ccc963b5e Author: Adnan Baruni <abar...@users.noreply.github.com> AuthorDate: Thu Nov 9 09:41:39 2017 -0600 Support retrieving status and configuration of feed triggers (#80) * add ability to retrieve feeds * add to integration test --- README.md | 1 + lib/feeds.js | 4 ++++ test/integration/feeds.test.js | 13 ++++++++----- test/unit/feeds.test.js | 22 ++++++++++++++++++++++ 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 159b3e3..057e276 100644 --- a/README.md +++ b/README.md @@ -247,6 +247,7 @@ ow.triggers.get({name: '...'}) ow.rules.get({name: '...'}) ow.namespaces.get({name: '...'}) ow.packages.get({name: '...'}) +ow.feeds.get({name: '...'}) ``` The following optional parameters are supported: diff --git a/lib/feeds.js b/lib/feeds.js index 37954cd..f8cdc28 100644 --- a/lib/feeds.js +++ b/lib/feeds.js @@ -21,6 +21,10 @@ class Feeds { return this.feed('CREATE', options) } + get (options) { + return this.feed('READ', options) + } + feed (event, options) { if (!this.feed_name(options)) { throw new Error(messages.MISSING_FEED_NAME_ERROR) diff --git a/test/integration/feeds.test.js b/test/integration/feeds.test.js index ec5c0c6..1ebd7b8 100644 --- a/test/integration/feeds.test.js +++ b/test/integration/feeds.test.js @@ -38,11 +38,14 @@ tempTest('create and delete a feed', t => { } return triggers.create({triggerName: 'sample_feed_trigger'}).then(() => feeds.create(feed_params)).then(result => { t.is(result.response.success, true) - return feeds.delete(feed_params).then(feed_result => { - t.is(feed_result.response.success, true) - return triggers.delete({triggerName: 'sample_feed_trigger'}).then(() => { - t.pass() - }) + return feeds.get(feed_params).then(get_result => { + t.is(get_result.response.success, true) + return feeds.delete(feed_params).then(feed_result => { + t.is(feed_result.response.success, true) + return triggers.delete({triggerName: 'sample_feed_trigger'}).then(() => { + t.pass() + }) + }).catch(errors) }).catch(errors) }).catch(errors) }) diff --git a/test/unit/feeds.test.js b/test/unit/feeds.test.js index e93f30f..d68ef6f 100644 --- a/test/unit/feeds.test.js +++ b/test/unit/feeds.test.js @@ -206,6 +206,28 @@ test('should be able to create feed using feedName with params', t => { return feeds.create({feedName: feed_name, trigger: trigger_name, params}) }) +test('should be able to get feed', t => { + const feed_name = 'feed_name' + const api_key = 'username:password' + const trigger_name = '/trigger_ns/trigger_name' + const client = {} + client.options = { api_key } + + const ns = '_' + const feeds = new Feeds(client) + + client.request = (method, path, options) => { + t.is(method, 'POST') + t.is(path, `namespaces/${ns}/actions/${feed_name}`) + t.deepEqual(options.qs, {blocking: true}) + t.deepEqual(options.body, {authKey: client.options.api_key, lifecycleEvent: 'READ', triggerName: `${trigger_name}`}) + } + + t.plan(4) + + return feeds.get({name: feed_name, trigger: trigger_name}) +}) + test('should throw errors without trigger parameter ', t => { const ns = '_' const client = { options: {} } -- To stop receiving notification emails like this one, please contact ['"commits@openwhisk.apache.org" <commits@openwhisk.apache.org>'].