From afc678fea066e8d5e75461bb078c0dacb2401eee Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 11 Sep 2018 14:46:25 +0200 Subject: [PATCH] pass rest session creator to scenario --- src/scenario.js | 2 +- start.js | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/scenario.js b/src/scenario.js index f7229057a8..f774a8649d 100644 --- a/src/scenario.js +++ b/src/scenario.js @@ -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'); diff --git a/start.js b/start.js index ac9a2f8684..c21fcd0a2d 100644 --- a/start.js +++ b/start.js @@ -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);