chore: Add target mirage config

This commit is contained in:
Susmitha Girumala committed 2020-08-21 11:58:46 -04:00
1 parent 748e42a64f
commit 639325ddd6
6 files changed
+37 -1

No files matched your search

+1 -1
View File
@@ -1,3 +1,3 @@
import GeneratedUserModel from '../generated/models/target';
import GeneratedTargetModel from '../generated/models/target';
export default class TargetModel extends GeneratedTargetModel {}
+8
View File
@@ -123,6 +123,14 @@ export default function() {
return hostSet.update(attrs);
});
// target
this.get('/scopes/:scope_id/targets');
this.post('/scopes/:scope_id/targets');
this.get('/scopes/:scope_id/targets/:id');
this.patch('/scopes/:scope_id/targets/:id');
this.del('/scopes/:scope_id/targets/:id');
// Uncomment the following line and the Response import above
// Then change the response code to simulate error responses.
// this.get('/scopes/:scope_id/projects', () => new Response(505));
+3
View File
@@ -0,0 +1,3 @@
import factory from '../generated/factories/target';
export default factory.extend();
@@ -0,0 +1,16 @@
import { Factory } from 'ember-cli-mirage';
import { random, date } from 'faker';
/**
* GeneratedTargetModelFactory
*/
export default Factory.extend({
protocol: 'SSH',
name: () => random.words(),
description: () => random.words(),
created_time: () => date.recent(),
updated_time: () => date.recent(),
disabled: () => random.boolean(),
});
+4
View File
@@ -35,4 +35,8 @@ export default function(server) {
server.createList('host-catalog', 2, { scope }, 'withChildren');
});
// Target
server.createList('target', 5, { scope });
}
+5
View File
@@ -0,0 +1,5 @@
import ApplicationSerializer from './application';
export default ApplicationSerializer.extend({
modelName: 'target'
});