chore: 🤖 add mock auth methods

This commit is contained in:
Randall Morey committed 2020-06-18 15:51:40 -04:00
1 parent 81b7ddbc11
commit 032be8e293
6 files changed
+46 -2

No files matched your search

@@ -34,4 +34,9 @@ export default class GeneratedAuthMethodModel extends BaseModel {
})
updated_time;
@attr('boolean', {
description: 'Whether the resource is disabled',
})
disabled;
}
+8
View File
@@ -32,6 +32,14 @@ export default function() {
this.patch('/orgs/:org_id/projects/:id');
this.del('/orgs/:org_id/projects/:id');
// Auth & IAM resources
this.get('/orgs/:org_id/auth-methods');
this.post('/orgs/:org_id/auth-methods');
this.get('/orgs/:org_id/auth-methods/:id');
this.patch('/orgs/:org_id/auth-methods/:id');
this.del('/orgs/:org_id/auth-methods/:id');
// Other resources
// host-catalog
+3
View File
@@ -0,0 +1,3 @@
import factory from '../generated/factories/auth-method';
export default factory.extend();
@@ -0,0 +1,16 @@
import { Factory } from 'ember-cli-mirage';
import { random, date } from 'faker';
/**
* GeneratedAuthMethodModelFactory
*/
export default Factory.extend({
type: 'password',
name: () => random.words(),
description: () => random.words(),
created_time: () => date.recent(),
updated_time: () => date.recent(),
disabled: () => random.boolean(),
});
+9 -2
View File
@@ -3,10 +3,17 @@ export default function(server) {
// Scope resources
server.createList('org', 3);
server.createList('project', 3);
server.createList('project', 6);
// Auth
// Auth methods exist both at the global scope and the org scope.
// For simplicity we don't scope our mock auth methods and just return the
// same items for request at all scopes.
server.createList('auth-method', 3);
// Other resources
server.createList('host-catalog', 3);
server.createList('host-catalog', 6);
}
@@ -0,0 +1,5 @@
import ApplicationSerializer from './application';
export default ApplicationSerializer.extend({
modelName: 'auth-method'
});