[AAE-9094] - Fix app breaking when configured with BASIC auth (#7672)

This commit is contained in:
Ardit Domi
2022-06-12 22:32:40 +01:00
committed by GitHub
parent 1b20e17ed7
commit 81e58ecfb2
2 changed files with 17 additions and 1 deletions

View File

@@ -92,6 +92,7 @@ describe('UserAccessService', () => {
beforeEach(() => {
spyOn(jwtHelperService, 'getValueFromLocalToken').and.returnValue(undefined);
getAccessFromApiSpy = spyOn(oauth2Service, 'get').and.returnValue(of(userAccessMock));
appConfigService.config.authType = 'OAUTH';
});
it('should return true when the user has one of the global roles', async () => {
@@ -137,5 +138,12 @@ describe('UserAccessService', () => {
expect(getAccessFromApiSpy).toHaveBeenCalledWith({ url: `${ fakeIdentityHost }/v1/identity/roles` });
});
it('should not fetch the access from the API if is not configured with OAUTH', async () => {
appConfigService.config.authType = 'BASIC';
await userAccessService.fetchUserAccess();
expect(getAccessFromApiSpy).not.toHaveBeenCalled();
});
});
});