Skip to content

Commit

Permalink
Market 'heartbeat' endpoint as public: no auth headers required to ac…
Browse files Browse the repository at this point in the history
…cess it. Updated corresponding Cucumber tests. Changed Mocha test to target endpoint different from 'heartbeat'.
  • Loading branch information
nick13jaremek committed Jan 26, 2016
1 parent eb10cee commit 438c371
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
3 changes: 3 additions & 0 deletions config/default.json
Expand Up @@ -23,6 +23,9 @@
"method": "POST",
"endpoint": "/api/identity"
},
{
"endpoint": "/heartbeat"
},
{
"endpoint": "/api/notification.*"
},
Expand Down
9 changes: 1 addition & 8 deletions cucumber/features/heartbeat.feature
@@ -1,12 +1,5 @@
Feature: Notifications component sends a 204 to confirm it is running

Scenario Outline: get the status of the notifications server
Given an authenticated identity in the app with <identity_id>
Scenario: get the status of the notifications server
When a user makes a GET to /heartbeat
Then the backend responds with 204

Examples:
| identity_id |
| 01f0000000000000003f0001 |
| 01f0000000000000003f0002 |
| 01f0000000000000003f0003 |
6 changes: 3 additions & 3 deletions cucumber/features/step_definitions/request_steps.js
Expand Up @@ -9,9 +9,9 @@ module.exports = function() {
this.When(/^a user makes a GET to (.*)$/, function(endpoint, callback) {
this.register('url', endpoint);

const request = this.buildRequest('GET', endpoint, {
'x-user-id': this.get('identity')
});
const headers = this.get('identity') ? { 'x-user-id': this.get('identity')} : {};

const request = this.buildRequest('GET', endpoint, headers);

this.register('request', request);
return callback();
Expand Down
4 changes: 2 additions & 2 deletions test/middlewares/check_identity.js
Expand Up @@ -9,10 +9,10 @@ const loadFixtures = require('./../../scripts/load_fixtures');

describe('Identity middleware', function() {

const hearbeatUrl = '/heartbeat';
const fetchIdentityUrl = '/api/identity';

let request = {
url: hearbeatUrl,
url: fetchIdentityUrl,
method: 'GET',
headers: {}
};
Expand Down

0 comments on commit 438c371

Please sign in to comment.