mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
Merge pull request #823 from Alfresco/dev-valbano-fix-818
Dev valbano fix 818
This commit is contained in:
commit
976432c883
@ -84,6 +84,21 @@ describe('AlfrescoAuthentication', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should save only ECM ticket on localStorage', (done) => {
|
||||
authService.login('fake-username', 'fake-password').subscribe(() => {
|
||||
expect(authService.isLoggedIn()).toBe(true);
|
||||
expect(authService.getTicketBpm()).toBeNull();
|
||||
expect(authService.getAlfrescoApi().bpmAuth.isLoggedIn()).toBeFalsy();
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 201,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify({'entry': {'id': 'fake-post-ticket', 'userId': 'admin'}})
|
||||
});
|
||||
});
|
||||
|
||||
it('should return ticket undefined when the credentials are wrong', (done) => {
|
||||
authService.login('fake-wrong-username', 'fake-wrong-password').subscribe(
|
||||
(res) => {
|
||||
@ -164,6 +179,21 @@ describe('AlfrescoAuthentication', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should save only BPM ticket on localStorage', (done) => {
|
||||
authService.login('fake-username', 'fake-password').subscribe(() => {
|
||||
expect(authService.isLoggedIn()).toBe(true);
|
||||
expect(authService.getTicketEcm()).toBeNull();
|
||||
expect(authService.getAlfrescoApi().ecmAuth.isLoggedIn()).toBeFalsy();
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 201,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify({'entry': {'id': 'fake-post-ticket', 'userId': 'admin'}})
|
||||
});
|
||||
});
|
||||
|
||||
it('should return ticket undefined when the credentials are wrong', (done) => {
|
||||
authService.login('fake-wrong-username', 'fake-wrong-password').subscribe(
|
||||
(res) => {
|
||||
|
@ -177,7 +177,7 @@ export class AlfrescoAuthenticationService {
|
||||
* The method save the ECM ticket in the localStorage
|
||||
*/
|
||||
public saveTicketEcm(): void {
|
||||
if (this.alfrescoApi) {
|
||||
if (this.alfrescoApi && this.alfrescoApi.getTicketEcm()) {
|
||||
localStorage.setItem('ticket-ECM', this.alfrescoApi.getTicketEcm());
|
||||
}
|
||||
}
|
||||
@ -186,7 +186,7 @@ export class AlfrescoAuthenticationService {
|
||||
* The method save the BPM ticket in the localStorage
|
||||
*/
|
||||
public saveTicketBpm(): void {
|
||||
if (this.alfrescoApi) {
|
||||
if (this.alfrescoApi && this.alfrescoApi.getTicketBpm()) {
|
||||
localStorage.setItem('ticket-BPM', this.alfrescoApi.getTicketBpm());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user