mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-01 14:41:32 +00:00
* Revert "AAE-30882 Replace superagent (#11134)"
This reverts commit a347b20f20
.
* AAE-0000 - Fixed lock for cli and adf
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
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 ', () => {
|
||||
@@ -210,23 +209,16 @@ 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);
|
||||
|
||||
const config = {
|
||||
hostEcm,
|
||||
hostEcm: 'https://testServer.com:1616',
|
||||
contextRoot: 'strangeContextRoot',
|
||||
withCredentials: true
|
||||
};
|
||||
const alfrescoJsApi = new AlfrescoApi(config);
|
||||
|
||||
let error;
|
||||
authEcmMock.get401InvalidRequest();
|
||||
|
||||
try {
|
||||
await alfrescoJsApi.login(undefined, undefined);
|
||||
} catch (e) {
|
||||
@@ -236,7 +228,7 @@ describe('Basic configuration test', () => {
|
||||
assert.equal(error, 'missing username or password');
|
||||
|
||||
error = undefined;
|
||||
authEcmMock.get401InvalidRequest();
|
||||
|
||||
try {
|
||||
await alfrescoJsApi.login('username', undefined);
|
||||
} catch (e) {
|
||||
@@ -246,7 +238,7 @@ describe('Basic configuration test', () => {
|
||||
assert.equal(error, 'missing username or password');
|
||||
|
||||
error = undefined;
|
||||
authEcmMock.get401InvalidRequest();
|
||||
|
||||
try {
|
||||
await alfrescoJsApi.login(undefined, 'password');
|
||||
} catch (e) {
|
||||
@@ -256,7 +248,7 @@ describe('Basic configuration test', () => {
|
||||
assert.equal(error, 'missing username or password');
|
||||
|
||||
error = undefined;
|
||||
authEcmMock.get401InvalidRequest();
|
||||
|
||||
try {
|
||||
await alfrescoJsApi.login('', '');
|
||||
} catch (e) {
|
||||
@@ -266,7 +258,7 @@ describe('Basic configuration test', () => {
|
||||
assert.equal(error, 'missing username or password');
|
||||
|
||||
error = undefined;
|
||||
authEcmMock.get401InvalidRequest();
|
||||
|
||||
try {
|
||||
await alfrescoJsApi.login('username', '');
|
||||
} catch (e) {
|
||||
@@ -276,7 +268,7 @@ describe('Basic configuration test', () => {
|
||||
assert.equal(error, 'missing username or password');
|
||||
|
||||
error = undefined;
|
||||
authEcmMock.get401InvalidRequest();
|
||||
|
||||
try {
|
||||
await alfrescoJsApi.login('', 'password');
|
||||
} catch (e) {
|
||||
@@ -325,15 +317,11 @@ describe('Basic configuration test', () => {
|
||||
});
|
||||
|
||||
it('Should logged-in be emitted when log in OAUTH', (done) => {
|
||||
const host = 'https://myOauthUrl:30081';
|
||||
const oauth2Mock = new OAuthMock(host);
|
||||
const authEcmMock = new EcmAuthMock(host);
|
||||
const oauth2Mock = new OAuthMock('https://myOauthUrl:30081');
|
||||
|
||||
oauth2Mock.get200Response();
|
||||
authEcmMock.get200ValidTicket();
|
||||
|
||||
const alfrescoJsApi = new AlfrescoApi({
|
||||
hostEcm: host,
|
||||
oauth2: {
|
||||
host: 'https://myOauthUrl:30081/auth/realms/springboot',
|
||||
clientId: 'activiti',
|
||||
|
Reference in New Issue
Block a user