Skip to content

Commit

Permalink
cleanup - remove dependency on env variables in replaceableVariables
Browse files Browse the repository at this point in the history
  • Loading branch information
HarshaNalluru committed Jan 24, 2020
1 parent 795cb0b commit b297cff
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions sdk/storage/storage-queue/test/utils/testutils.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,30 @@ export function isBrowser(): boolean {
return typeof window !== "undefined";
}

const mockAccountName = "fakestorageaccount";
const mockAccountKey = "aaaaa";
export const recorderEnvSetup: RecorderEnvironmentSetup = {
replaceableVariables: {
// Used in record and playback modes
// 1. The key-value pairs will be used as the environment variables in playback mode
// 2. If the env variales are present in the recordings as plain strings, they will be replaced with the provided values in record mode
ACCOUNT_NAME: "fakestorageaccount",
ACCOUNT_KEY: "aaaaa",
ACCOUNT_SAS: "aaaaa",
STORAGE_CONNECTION_STRING: `DefaultEndpointsProtocol=https;AccountName=${env.ACCOUNT_NAME};AccountKey=${env.ACCOUNT_KEY};EndpointSuffix=core.windows.net`,
ACCOUNT_NAME: `${mockAccountName}`,
ACCOUNT_KEY: `${mockAccountKey}`,
ACCOUNT_SAS: `${mockAccountKey}`,
STORAGE_CONNECTION_STRING: `DefaultEndpointsProtocol=https;AccountName=${mockAccountName};AccountKey=${mockAccountKey};EndpointSuffix=core.windows.net`,
// Comment following line to skip user delegation key/SAS related cases in record and play
// which depends on this environment variable
ACCOUNT_TOKEN: "aaaaa"
ACCOUNT_TOKEN: `${mockAccountKey}`
},
replaceInRecordings: [
// Used in record mode
// Array of callback functions can be provided to customize the generated recordings in record mode
// `sig` param of SAS Token is being filtered here
(recording: string): string =>
recording.replace(new RegExp(env.ACCOUNT_SAS.match("(.*)&sig=(.*)")[2], "g"), "aaaaa")
recording.replace(
new RegExp(env.ACCOUNT_SAS.match("(.*)&sig=(.*)")[2], "g"),
`${mockAccountKey}`
)
],
// SAS token may contain sensitive information
queryParametersToSkip: [
Expand Down

0 comments on commit b297cff

Please sign in to comment.