chore: Add target mirage config
This commit is contained in:
6 files changed
+37
-1
No files matched your search
@@ -1,3 +1,3 @@
|
||||
import GeneratedUserModel from '../generated/models/target';
|
||||
import GeneratedTargetModel from '../generated/models/target';
|
||||
|
||||
export default class TargetModel extends GeneratedTargetModel {}
|
||||
@@ -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));
|
||||
|
||||
@@ -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(),
|
||||
|
||||
});
|
||||
@@ -35,4 +35,8 @@ export default function(server) {
|
||||
server.createList('host-catalog', 2, { scope }, 'withChildren');
|
||||
});
|
||||
|
||||
// Target
|
||||
|
||||
server.createList('target', 5, { scope });
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import ApplicationSerializer from './application';
|
||||
|
||||
export default ApplicationSerializer.extend({
|
||||
modelName: 'target'
|
||||
});
|
||||
Reference in new issue
Block a user