-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3406 from RedisInsight/be/feature/RI-5661_rdi_auth
#RI-5661 - add rdi auth
- Loading branch information
Showing
40 changed files
with
1,033 additions
and
293 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class Rdi1716370509836 implements MigrationInterface { | ||
name = 'Rdi1716370509836' | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`CREATE TABLE "rdi" ("id" varchar PRIMARY KEY NOT NULL, "url" varchar, "name" varchar NOT NULL, "username" varchar NOT NULL, "password" varchar NOT NULL, "lastConnection" datetime, "version" varchar NOT NULL, "encryption" varchar)`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP TABLE "rdi"`); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { | ||
Rdi, | ||
RdiClientMetadata, | ||
} from 'src/modules/rdi/models'; | ||
import { ApiRdiClient } from 'src/modules/rdi/client/api.rdi.client'; | ||
|
||
export const mockRdiId = 'rdiId'; | ||
|
||
export class MockRdiClient extends ApiRdiClient { | ||
constructor(metadata: RdiClientMetadata, client: any = jest.fn()) { | ||
super(metadata, client); | ||
} | ||
|
||
public getSchema = jest.fn(); | ||
|
||
public getPipeline = jest.fn(); | ||
|
||
public getTemplate = jest.fn(); | ||
|
||
public getStrategies = jest.fn(); | ||
|
||
public deploy = jest.fn(); | ||
|
||
public deployJob = jest.fn(); | ||
|
||
public dryRunJob = jest.fn(); | ||
|
||
public testConnections = jest.fn(); | ||
|
||
public getStatistics = jest.fn(); | ||
|
||
public getPipelineStatus = jest.fn(); | ||
|
||
public getJobFunctions = jest.fn(); | ||
|
||
public connect = jest.fn(); | ||
|
||
public ensureAuth = jest.fn(); | ||
} | ||
|
||
export const generateMockRdiClient = ( | ||
metadata: RdiClientMetadata, | ||
client = jest.fn(), | ||
): MockRdiClient => new MockRdiClient(metadata as RdiClientMetadata, client); | ||
|
||
export const mockRdiClientMetadata: RdiClientMetadata = { | ||
sessionMetadata: undefined, | ||
id: mockRdiId, | ||
}; | ||
|
||
export const mockRdi = Object.assign(new Rdi(), { | ||
name: 'name', | ||
version: '1.2', | ||
url: 'http://localhost:4000', | ||
password: 'pass', | ||
username: 'user', | ||
}); | ||
|
||
export const mockRdiUnauthorizedError = { | ||
message: 'Request failed with status code 401', | ||
response: { | ||
status: 401, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.