Skip to content

Commit

Permalink
Merge branch 'hotfix/message-send-receive-tests' into 'develop'
Browse files Browse the repository at this point in the history
use new authentication scheme in message-send-receive tests

See merge request blockchain/identitychain/api!13
  • Loading branch information
omer-ilhan committed Aug 21, 2018
2 parents 8a217f1 + 395fea7 commit b0e3db5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/3-test-behaviour.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ describe('behaviour', function() {

it('POST /api/message should return HTTP 202 on valid connection request', async function() {
this.timeout(60000);
bothHeaders.Authorization = users[0].token;
await agent
.post('/api/message')
.auth(users[0].username, users[0].password)
.set(bothHeaders)
.send({
wallet: wallets[0].id,
Expand All @@ -217,9 +217,9 @@ describe('behaviour', function() {
});

it('GET /api/message should return list of messages', async function() {
bothHeaders.Authorization = users[1].token;
const res = await agent
.get('/api/message')
.auth(users[1].username, users[1].password)
.set(bothHeaders)
.set({ wallet: wallets[1].id })
.expect(200);
Expand All @@ -231,9 +231,9 @@ describe('behaviour', function() {
});

it('GET /api/message/:messageId should retrieve a single message', async function() {
bothHeaders.Authorization = users[1].token;
const res = await agent
.get('/api/message/' + messageId)
.auth(users[1].username, users[1].password)
.set(bothHeaders)
.set({ wallet: wallets[1].id })
.expect(200);
Expand All @@ -242,15 +242,14 @@ describe('behaviour', function() {
});

it('DELETE /api/message/:messageId should delete a single message', async function() {
bothHeaders.Authorization = users[1].token;
await agent
.delete('/api/message/' + messageId)
.auth(users[1].username, users[1].password)
.set(bothHeaders)
.set({ wallet: wallets[1].id })
.expect(204);
await agent
.get('/api/message/' + messageId)
.auth(users[1].username, users[1].password)
.set(bothHeaders)
.set({ wallet: wallets[1].id })
.expect(404);
Expand Down

0 comments on commit b0e3db5

Please sign in to comment.