pass rest session creator to scenario

This commit is contained in:
Bruno Windels 2018-09-11 14:46:25 +02:00
parent 98aafd6abb
commit afc678fea0
2 changed files with 13 additions and 2 deletions

View file

@ -28,7 +28,7 @@ const acceptServerNoticesInviteAndConsent = require('./tests/server-notices-cons
const getE2EDeviceFromSettings = require('./tests/e2e-device');
const verifyDeviceForUser = require("./tests/verify-device");
module.exports = async function scenario(createSession) {
module.exports = async function scenario(createSession, createRestSession) {
async function createUser(username) {
const session = await createSession(username);
await signup(session, session.username, 'testtest');

View file

@ -17,6 +17,7 @@ limitations under the License.
const assert = require('assert');
const RiotSession = require('./src/session');
const scenario = require('./src/scenario');
const RestSessionFactory = require('./src/rest/factory');
const program = require('commander');
program
@ -40,6 +41,16 @@ async function runTests() {
options.executablePath = path;
}
const restFactory = new RestSessionFactory(
'synapse/installations/consent',
'http://localhost:5005',
__dirname
);
function createRestSession(username, password) {
return restFactory.createSession(username, password);
}
async function createSession(username) {
const session = await RiotSession.create(username, options, program.riotUrl);
sessions.push(session);
@ -48,7 +59,7 @@ async function runTests() {
let failure = false;
try {
await scenario(createSession);
await scenario(createSession, createRestSession);
} catch(err) {
failure = true;
console.log('failure: ', err);