refactor: API: Add AuthMethodOIDC class to hold static states
This commit is contained in:
8 files changed
+52
-7
No files matched your search
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Empty auth method definition
|
||||
*/
|
||||
export class AuthMethod {}
|
||||
|
||||
/**
|
||||
* Simple OIDC auth method definition to contain possible oidc states.
|
||||
* @property states {[string]} states
|
||||
*/
|
||||
export class AuthMethodOIDC extends AuthMethod {
|
||||
/**
|
||||
* Possible auth-method statuses
|
||||
*/
|
||||
static states = ['inactive', 'active-private', 'active-public'];
|
||||
}
|
||||
@@ -28,8 +28,6 @@ export const options = {
|
||||
};
|
||||
|
||||
export default class AuthMethodModel extends GeneratedAuthMethodModel {
|
||||
STATES_ENUM = options.oidc.state;
|
||||
|
||||
// =error attributes
|
||||
// These attributes exist solely to capture errors on nested fields.
|
||||
// See the application adapter's error normalization method for
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'api/classes/auth-method';
|
||||
@@ -0,0 +1,22 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { AuthMethod, AuthMethodOIDC } from 'api/classes/auth-method';
|
||||
|
||||
module('Unit | Class | auth method', function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
|
||||
test('it exists', function (assert) {
|
||||
assert.ok(AuthMethod);
|
||||
assert.ok(AuthMethodOIDC);
|
||||
});
|
||||
|
||||
test('oidc auth method lists states', function (assert) {
|
||||
assert.deepEqual(AuthMethodOIDC.states, [
|
||||
'inactive',
|
||||
'active-private',
|
||||
'active-public',
|
||||
]);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user