Register test auth before load

This commit is contained in:
Alexandre Bodin 2021-09-08 18:23:52 +02:00
parent a14b16af51
commit 4befaea442
2 changed files with 5 additions and 6 deletions

View File

@ -69,8 +69,6 @@ const createAuthentication = () => {
} }
} }
console.log('ici');
return ctx.unauthorized('Missing credentials'); return ctx.unauthorized('Missing credentials');
}, },
async verify(auth, config = {}) { async verify(auth, config = {}) {

View File

@ -20,11 +20,10 @@ const createStrapiInstance = async ({ ensureSuperAdmin = true, logLevel = 'fatal
const options = { dir: TEST_APP_URL }; const options = { dir: TEST_APP_URL };
const instance = strapi(options); const instance = strapi(options);
await instance.load(); instance.container.get('auth').register('content-api', {
name: 'test-auth',
instance.container.get('auth').register({
name: 'test-strategy',
authenticate() { authenticate() {
console.log('lala');
return { authenticated: true }; return { authenticated: true };
}, },
verify() { verify() {
@ -32,6 +31,8 @@ const createStrapiInstance = async ({ ensureSuperAdmin = true, logLevel = 'fatal
}, },
}); });
await instance.load();
instance.log.level = logLevel; instance.log.level = logLevel;
instance.server.mount(); instance.server.mount();