From c675f790ef7ab46f997ac0c8904244c06faaa4d0 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Fri, 29 Jul 2022 15:18:57 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20change=20password=20route?= =?UTF-8?q?=20should=20not=20error=20(#1228)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/api/mirage/route-handlers/auth.js | 2 +- addons/api/mirage/scenarios/default.js | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/addons/api/mirage/route-handlers/auth.js b/addons/api/mirage/route-handlers/auth.js index edb5647b7..62533488b 100644 --- a/addons/api/mirage/route-handlers/auth.js +++ b/addons/api/mirage/route-handlers/auth.js @@ -43,7 +43,7 @@ const commandHandlers = { scope: scopeAttrs, id: 'token123', token: 'thetokenstring', - account_id: '1', + account_id: 'authenticatedaccount', user_id: 'authenticateduser', auth_method_id: 'authmethod123', created_time: '', diff --git a/addons/api/mirage/scenarios/default.js b/addons/api/mirage/scenarios/default.js index 368d1299e..b956aad19 100644 --- a/addons/api/mirage/scenarios/default.js +++ b/addons/api/mirage/scenarios/default.js @@ -17,8 +17,6 @@ export default function (server) { 'withChildren' )[0]; - server.create('user', { id: 'authenticateduser', scope: globalScope }); - // Auth const globalAuthMethods = server.createList( 'auth-method', @@ -32,6 +30,18 @@ export default function (server) { { scope: orgScope }, 'withAccountsAndUsersAndManagedGroups' ); + // Authenticated user/account + const user = server.create('user', { + id: 'authenticateduser', + scope: globalScope, + }); + const { id: accountID } = server.create('account', { + id: 'authenticatedaccount', + scope: globalScope, + authMethod: globalAuthMethods[0], + type: 'password', + }); + user.update({ accountIds: [accountID] }); // Assign primary auth methods per scope // TODO make this generic globalScope.update({ primaryAuthMethodId: globalAuthMethods[0].id });