added a test for logging in with a claim id
This commit is contained in:
parent
61b4480d2b
commit
2f7b023222
2 changed files with 17 additions and 2 deletions
|
@ -35,6 +35,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
testing: {
|
testing: {
|
||||||
testChannel : '@testpublishchannel', // a channel to make test publishes in
|
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
|
testChannelPassword: 'password', // password for the test channel
|
||||||
},
|
},
|
||||||
api: {
|
api: {
|
||||||
|
|
|
@ -3,7 +3,7 @@ const expect = chai.expect;
|
||||||
const chaiHttp = require('chai-http');
|
const chaiHttp = require('chai-http');
|
||||||
const { site, testing } = require('../../config/speechConfig.js');
|
const { site, testing } = require('../../config/speechConfig.js');
|
||||||
const { host } = site;
|
const { host } = site;
|
||||||
const { testChannel, testChannelPassword } = testing;
|
const { testChannel, testChannelId, testChannelPassword } = testing;
|
||||||
const requestTimeout = 20000;
|
const requestTimeout = 20000;
|
||||||
const publishTimeout = 120000;
|
const publishTimeout = 120000;
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
@ -109,6 +109,7 @@ describe('end-to-end', function () {
|
||||||
const filePath = './test/mock-data/bird.jpeg';
|
const filePath = './test/mock-data/bird.jpeg';
|
||||||
const fileName = 'byrd.jpeg';
|
const fileName = 'byrd.jpeg';
|
||||||
const channelName = testChannel;
|
const channelName = testChannel;
|
||||||
|
const channelId = testChannelId;
|
||||||
const channelPassword = testChannelPassword;
|
const channelPassword = testChannelPassword;
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
const name = `test-publish-${date.getFullYear()}-${date.getMonth()}-${date.getDate()}-${date.getTime()}`;
|
const name = `test-publish-${date.getFullYear()}-${date.getMonth()}-${date.getDate()}-${date.getTime()}`;
|
||||||
|
@ -129,7 +130,7 @@ describe('end-to-end', function () {
|
||||||
});
|
});
|
||||||
}).timeout(publishTimeout);
|
}).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)
|
chai.request(host)
|
||||||
.post(publishUrl)
|
.post(publishUrl)
|
||||||
.type('form')
|
.type('form')
|
||||||
|
@ -143,6 +144,19 @@ describe('end-to-end', function () {
|
||||||
});
|
});
|
||||||
}).timeout(publishTimeout);
|
}).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 () {
|
describe('anonymous publishes', function () {
|
||||||
|
|
Loading…
Reference in a new issue