mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 12:27:31 +00:00
more mock
This commit is contained in:
@@ -1,11 +1,15 @@
|
|||||||
import nock from "nock";
|
import nock from "nock";
|
||||||
|
|
||||||
export const mockThirdPartyApiCalls = () => {
|
const CLOUDFLARE_ACCOUNT_ID = "A2A6347F-88B5-442D-9798-95E408BC7701";
|
||||||
|
|
||||||
|
// We mock the Cloudflare account API calls to let adding app connection much easier in BDD tests.
|
||||||
|
// It's mainly for the DNS provider validation in ACME challenge validation.
|
||||||
|
const mockCloudflare = () => {
|
||||||
nock("https://api.cloudflare.com:443")
|
nock("https://api.cloudflare.com:443")
|
||||||
.get("/client/v4/accounts/MOCK_ACCOUNT_ID")
|
.get("/client/v4/accounts/MOCK_ACCOUNT_ID")
|
||||||
.reply(200, {
|
.reply(200, {
|
||||||
result: {
|
result: {
|
||||||
id: "A2A6347F-88B5-442D-9798-95E408BC7701",
|
id: CLOUDFLARE_ACCOUNT_ID,
|
||||||
name: "Mock Account",
|
name: "Mock Account",
|
||||||
type: "standard",
|
type: "standard",
|
||||||
settings: {
|
settings: {
|
||||||
@@ -53,7 +57,7 @@ export const mockThirdPartyApiCalls = () => {
|
|||||||
},
|
},
|
||||||
owner: { id: null, type: "user", email: null },
|
owner: { id: null, type: "user", email: null },
|
||||||
account: {
|
account: {
|
||||||
id: "A2A6347F-88B5-442D-9798-95E408BC7701",
|
id: CLOUDFLARE_ACCOUNT_ID,
|
||||||
name: "Mock Account"
|
name: "Mock Account"
|
||||||
},
|
},
|
||||||
tenant: { id: null, name: null },
|
tenant: { id: null, name: null },
|
||||||
@@ -85,3 +89,7 @@ export const mockThirdPartyApiCalls = () => {
|
|||||||
messages: []
|
messages: []
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const mockThirdPartyApiCalls = () => {
|
||||||
|
mockCloudflare();
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user