mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
AAE-30882 - Checking why is ok locally but fails on CI
This commit is contained in:
@@ -258,7 +258,7 @@ export class AxiosHttpClient implements HttpClient {
|
||||
|
||||
try {
|
||||
document.cookie = `CSRF-TOKEN=${token};path=/`;
|
||||
} catch (err) {
|
||||
} catch {
|
||||
/* continue regardless of error */
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@
|
||||
import assert from 'assert';
|
||||
import { AlfrescoApi } from '../src';
|
||||
import { BpmAuthMock, EcmAuthMock, OAuthMock } from './mockObjects';
|
||||
import nock from 'nock';
|
||||
|
||||
describe('Basic configuration test', () => {
|
||||
describe('config parameter ', () => {
|
||||
@@ -209,16 +210,23 @@ describe('Basic configuration test', () => {
|
||||
});
|
||||
|
||||
describe('login', () => {
|
||||
beforeEach(() => {
|
||||
nock.cleanAll();
|
||||
});
|
||||
|
||||
it('Should login be rejected if username or password are not provided', async () => {
|
||||
const hostEcm = 'https://testServer.com:1616';
|
||||
const authEcmMock = new EcmAuthMock(hostEcm); // ✅ HAS MOCK
|
||||
|
||||
const config = {
|
||||
hostEcm: 'https://testServer.com:1616',
|
||||
hostEcm,
|
||||
contextRoot: 'strangeContextRoot',
|
||||
withCredentials: true
|
||||
};
|
||||
const alfrescoJsApi = new AlfrescoApi(config);
|
||||
|
||||
let error;
|
||||
|
||||
authEcmMock.get401InvalidRequest();
|
||||
try {
|
||||
await alfrescoJsApi.login(undefined, undefined);
|
||||
} catch (e) {
|
||||
|
@@ -82,6 +82,20 @@ export class EcmAuthMock extends BaseMock {
|
||||
});
|
||||
}
|
||||
|
||||
get401InvalidRequest(): void {
|
||||
this.createNockWithCors()
|
||||
.get('/.*tickets.*/')
|
||||
.reply(401, {
|
||||
error: {
|
||||
errorKey: 'framework.exception.ApiDefault',
|
||||
statusCode: 401,
|
||||
briefSummary: '05210059 Authentication failed for Web Script org/alfresco/api/ResourceWebScript.get',
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get403Response(): void {
|
||||
this.createNockWithCors()
|
||||
.post('/alfresco/api/-default-/public/authentication/versions/1/tickets', {
|
||||
|
Reference in New Issue
Block a user