added a test for logging in with a claim id

This commit is contained in:
bill bittner 2018-03-05 19:22:42 -08:00
parent 61b4480d2b
commit 2f7b023222
2 changed files with 17 additions and 2 deletions

View file

@ -35,6 +35,7 @@ module.exports = {
},
testing: {
testChannel : '@testpublishchannel', // a channel to make test publishes in
testChannelId : 'xyz123...', // the claim id for the test channel
testChannelPassword: 'password', // password for the test channel
},
api: {

View file

@ -3,7 +3,7 @@ const expect = chai.expect;
const chaiHttp = require('chai-http');
const { site, testing } = require('../../config/speechConfig.js');
const { host } = site;
const { testChannel, testChannelPassword } = testing;
const { testChannel, testChannelId, testChannelPassword } = testing;
const requestTimeout = 20000;
const publishTimeout = 120000;
const fs = require('fs');
@ -109,6 +109,7 @@ describe('end-to-end', function () {
const filePath = './test/mock-data/bird.jpeg';
const fileName = 'byrd.jpeg';
const channelName = testChannel;
const channelId = testChannelId;
const channelPassword = testChannelPassword;
const date = new Date();
const name = `test-publish-${date.getFullYear()}-${date.getMonth()}-${date.getDate()}-${date.getTime()}`;
@ -129,7 +130,7 @@ describe('end-to-end', function () {
});
}).timeout(publishTimeout);
it(`should receive a status code 400 if wrong password`, function (done) {
it(`should receive a status code 400 if the wrong password is used with the channel name`, function (done) {
chai.request(host)
.post(publishUrl)
.type('form')
@ -143,6 +144,19 @@ describe('end-to-end', function () {
});
}).timeout(publishTimeout);
it(`should receive a status code 400 if the wrong password is used with the channel id`, function (done) {
chai.request(host)
.post(publishUrl)
.type('form')
.attach('file', fs.readFileSync(filePath), fileName)
.field('name', name)
.field('channelName', channelName)
.field('channelPassword', 'xxxxx')
.end(function (err, res) {
expect(res).to.have.status(400);
done();
});
}).timeout(publishTimeout);
});
describe('anonymous publishes', function () {