[ADF-2200] fixed problem with redirection url (#2877)

* [ADF-2200] fixed wrong handling of redirectUrl

* [ADF-2200] fixed problem with redirection url

* [ADF-2200] fixed redirection config path

* [ADF-2200] fixed wrong fdescribe test

* [ADF-2200] removed authserviceMock and fixed some tests
This commit is contained in:
Vito
2018-01-25 12:48:47 +01:00
committed by Eugenio Romano
parent 9f88c02ef3
commit 77f6c51dc2
14 changed files with 255 additions and 100 deletions

View File

@@ -258,6 +258,18 @@ describe('AuthenticationService', () => {
expect(authService.isLoggedIn()).toBe(false);
expect(authService.isEcmLoggedIn()).toBe(false);
});
it('[ECM] should set/get redirectUrl when provider is ECM', () => {
authService.setRedirectUrl({provider: 'ECM', url: 'some-url' } );
expect(authService.getRedirectUrl(preferences.authType)).toBe('some-url');
});
it('[ECM] should set/get redirectUrl when provider is BPM', () => {
authService.setRedirectUrl({provider: 'BPM', url: 'some-url' } );
expect(authService.getRedirectUrl(preferences.authType)).toBeNull();
});
});
describe('when the setting is BPM', () => {
@@ -367,6 +379,18 @@ describe('AuthenticationService', () => {
'status': 403
});
});
it('[BPM] should set/get redirectUrl when provider is BPM', () => {
authService.setRedirectUrl({provider: 'BPM', url: 'some-url' } );
expect(authService.getRedirectUrl(preferences.authType)).toBe('some-url');
});
it('[BPM] should set/get redirectUrl when provider is ECM', () => {
authService.setRedirectUrl({provider: 'ECM', url: 'some-url' } );
expect(authService.getRedirectUrl(preferences.authType)).toBeNull();
});
});
describe('when the setting is both ECM and BPM ', () => {
@@ -396,7 +420,7 @@ describe('AuthenticationService', () => {
});
});
xit('[ALL] should return login fail if only ECM call fail', (done) => {
it('[ALL] should return login fail if only ECM call fail', (done) => {
authService.login('fake-username', 'fake-password').subscribe(
(res) => {
},
@@ -417,7 +441,7 @@ describe('AuthenticationService', () => {
});
});
xit('[ALL] should return login fail if only BPM call fail', (done) => {
it('[ALL] should return login fail if only BPM call fail', (done) => {
authService.login('fake-username', 'fake-password').subscribe(
(res) => {
},
@@ -461,11 +485,24 @@ describe('AuthenticationService', () => {
'status': 403
});
});
it('[ALL] should set/get redirectUrl when provider is ALL', () => {
authService.setRedirectUrl({provider: 'ALL', url: 'some-url' } );
expect(authService.getRedirectUrl(preferences.authType)).toBe('some-url');
});
it('[ALL] should set/get redirectUrl when provider is BPM', () => {
authService.setRedirectUrl({provider: 'BPM', url: 'some-url' } );
expect(authService.getRedirectUrl(preferences.authType)).toBe('some-url');
});
it('[ALL] should set/get redirectUrl when provider is ECM', () => {
authService.setRedirectUrl({provider: 'ECM', url: 'some-url' } );
expect(authService.getRedirectUrl(preferences.authType)).toBe('some-url');
});
});
it('should set/get redirectUrl', () => {
authService.setRedirectUrl('some-url');
expect(authService.getRedirectUrl()).toBe('some-url');
});
});