From e153cf1be69f7fed89c3fd65dda1d15a73b41892 Mon Sep 17 00:00:00 2001 From: Dharini Jeeva Date: Mon, 14 Mar 2022 11:35:10 -0700 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Update=20mirage=20respo?= =?UTF-8?q?nses=20to=20support=20SSH=20targets=20(#1021)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 🎸 add type check helper methods to target model * chore: 🤖 include ssh type to target mirage data --- addons/api/mirage/factories/target.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/api/mirage/factories/target.js b/addons/api/mirage/factories/target.js index 6056352d7..99f9195e1 100644 --- a/addons/api/mirage/factories/target.js +++ b/addons/api/mirage/factories/target.js @@ -5,6 +5,7 @@ import permissions from '../helpers/permissions'; const randomBoolean = (chance = 0.5) => Math.random() < chance; const hostSetChance = 0.3; +const types = ['tcp', 'ssh']; export default factory.extend({ authorized_actions: () => @@ -24,12 +25,12 @@ export default factory.extend({ * -1 means "unlimited" and we want to generate these on occasion. */ session_connection_limit: () => random.arrayElement([-1, datatype.number()]), - + type: (i) => types[i % types.length], /** * Generates attributes fields by type. */ afterCreate(target) { - if (target.type === 'tcp') { + if (target.type === 'tcp' || target.type === 'ssh') { target.update({ attributes: { default_port: datatype.number(),