chore: 🤖 Update mirage responses to support SSH targets (#1021)

* feat: 🎸 add type check helper methods to target model

* chore: 🤖 include ssh type to target mirage data
This commit is contained in:
Dharini Jeeva authored and GitHub committed 2022-03-14 11:35:10 -07:00
1 parent a9a82079ac
commit e153cf1be6
1 file changed
+3 -2
+3 -2
View File
@@ -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(),