github-advanced-security[bot] commented on code in PR #7894: URL: https://github.com/apache/trafficcontrol/pull/7894#discussion_r1443832198
########## experimental/traffic-portal/cypress.config.ts: ########## @@ -0,0 +1,403 @@ +/* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +import { promises as fs } from "fs"; +import * as https from "https"; + +import axios, { type AxiosError } from "axios"; +import { defineConfig } from "cypress"; +import type { + CDN, + LoginRequest, + ProfileType, + RequestASN, + RequestCacheGroup, + RequestCoordinate, + RequestDeliveryService, + RequestDivision, + RequestParameter, + RequestPhysicalLocation, + RequestProfile, + RequestRegion, + RequestRole, + RequestServer, + RequestServerCapability, + RequestStatus, + RequestSteeringTarget, + RequestTenant, + RequestType, + ResponseCacheGroup, + ResponseDeliveryService, + ResponseDivision, + ResponseParameter, + ResponsePhysicalLocation, + ResponseProfile, + ResponseRegion, + ResponseStatus, + TypeFromResponse +} from "trafficops-types"; + +import type { CreatedData } from "./cypress/support/testing.data"; + +/** + * Creates mock data needed for E2E testing. + * + * Ideally this functionality would go in a different file, but for some reason + * Cypress gets very upset if you import anything but a type from any TypeScript + * file in this config file. + * + * @param toURL The URL of a Traffic Ops instance e.g. 'https://traffic.ops/'. + * @param apiVersion The version of the API to use e.g. '4.1'. + * @param adminUser The username of the 'admin' Role user that will be used + * to set up testing data. + * @param adminPass The password of the 'admin' Role user that will be used to + * set up testing data. + * @returns The data that was created and the unique string that was appended to + * all names that are required to be unique. + */ +async function createData(toURL: string, apiVersion: string, adminUser: string, adminPass: string): Promise<CreatedData> { + const apiUrl = `${toURL}/api/${apiVersion}`; + const client = axios.create({ + httpsAgent: new https.Agent({ + rejectUnauthorized: false Review Comment: ## Disabling certificate validation Disabling certificate validation is strongly discouraged. [Show more details](https://github.com/apache/trafficcontrol/security/code-scanning/314) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
