Repository: incubator-usergrid Updated Branches: refs/heads/two-dot-o-dev c99fe385f -> 6ad32c363
rest test fixes Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/6ad32c36 Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/6ad32c36 Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/6ad32c36 Branch: refs/heads/two-dot-o-dev Commit: 6ad32c363fb77b42f925a1913c9a49fe3d9df8cd Parents: c99fe38 Author: Shawn Feldman <sfeld...@apache.org> Authored: Mon Aug 3 17:05:23 2015 -0600 Committer: Shawn Feldman <sfeld...@apache.org> Committed: Mon Aug 3 17:05:23 2015 -0600 ---------------------------------------------------------------------- stack/rest_integration_tests/config/default.js | 2 +- stack/rest_integration_tests/lib/connections.js | 2 ++ .../rest_integration_tests/lib/notifications.js | 36 +++++++++++++++----- .../test/notifications/create.js | 2 +- 4 files changed, 32 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6ad32c36/stack/rest_integration_tests/config/default.js ---------------------------------------------------------------------- diff --git a/stack/rest_integration_tests/config/default.js b/stack/rest_integration_tests/config/default.js index 35ea397..5140638 100644 --- a/stack/rest_integration_tests/config/default.js +++ b/stack/rest_integration_tests/config/default.js @@ -33,5 +33,5 @@ module.exports = { latitude: 51.51279, longitude: -0.09184 }, - notifierName: "apple-dev" + notifierName: "noop-dev" }; http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6ad32c36/stack/rest_integration_tests/lib/connections.js ---------------------------------------------------------------------- diff --git a/stack/rest_integration_tests/lib/connections.js b/stack/rest_integration_tests/lib/connections.js index ddc830c..a1b8fcb 100644 --- a/stack/rest_integration_tests/lib/connections.js +++ b/stack/rest_integration_tests/lib/connections.js @@ -46,6 +46,7 @@ module.exports = { results.from.uuid + "/" + relationship + "/" + results.to.uuid; + url = urls.appendOrgCredentials(url) request.post({ url: url, json: true @@ -119,6 +120,7 @@ module.exports = { results.from.uuid + "/" + relationship + "/" + results.to.uuid; + url = urls.appendOrgCredentials(url); request.del({ url: url, json: true http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6ad32c36/stack/rest_integration_tests/lib/notifications.js ---------------------------------------------------------------------- diff --git a/stack/rest_integration_tests/lib/notifications.js b/stack/rest_integration_tests/lib/notifications.js index 33fef16..7834e2c 100644 --- a/stack/rest_integration_tests/lib/notifications.js +++ b/stack/rest_integration_tests/lib/notifications.js @@ -20,29 +20,49 @@ var random = require("./random"); var responseLib = require("./response"); var async = require('async'); var request = require("request"); +var random = require("./random"); + module.exports = { + create: function(message, cb) { + var notifierName = config.notifierName + "_" + random.randomString(5); + // Need to ensure at least one device exists in the devices collection request.post({ - url: urls.appendOrgCredentials(urls.appUrl() + "/devices"), + url: urls.appendOrgCredentials(urls.appUrl() + "notifiers"), json: true, body: { - name: "testDevice" + name: notifierName, + provider: "noop" } }, function(e, r, body) { - payload = {}; - payload[config.notifierName] = message; + var error = responseLib.getError(e, r); + if(error){ + return cb(error) + } request.post({ - url: urls.appendOrgCredentials(urls.appUrl() + "/devices;ql=select */notifications"), + url: urls.appendOrgCredentials(urls.appUrl() + "devices"), json: true, body: { - payloads: payload + name: "testDevice" } }, function(e, r, body) { - var error = responseLib.getError(e, r); - cb(error, error ? error : body); + payload = {}; + payload[notifierName] = message; + request.post({ + url: urls.appendOrgCredentials(urls.appUrl() + "devices;ql=/notifications"), + json: true, + body: { + payloads: payload + } + }, function(e, r, body) { + var error = responseLib.getError(e, r); + cb(error, error ? error : body); + }); }); }); + + } }; http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6ad32c36/stack/rest_integration_tests/test/notifications/create.js ---------------------------------------------------------------------- diff --git a/stack/rest_integration_tests/test/notifications/create.js b/stack/rest_integration_tests/test/notifications/create.js index 9a962fe..b3a2bb7 100644 --- a/stack/rest_integration_tests/test/notifications/create.js +++ b/stack/rest_integration_tests/test/notifications/create.js @@ -27,7 +27,7 @@ module.exports = { notifications.create("Hello World!", function(err, body) { should(err).be.null; body.entities.should.be.an.instanceOf(Array).and.have.lengthOf(1); - body.entities[0].state.should.equal('CREATED'); + body.entities[0].state.should.equal('FINISHED'); done(); }); });