Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
9ac07dd
starter code - handle browser recordings
HarshaNalluru Apr 20, 2021
c508d34
changelog
HarshaNalluru Apr 20, 2021
f56a3be
Update matchRequest with applyRequestBodyTransformations
HarshaNalluru Apr 20, 2021
acdb7bb
update test
HarshaNalluru Apr 20, 2021
60b2d93
Update sdk/test-utils/recorder/src/utils/requestBodyTransform.ts
HarshaNalluru Apr 20, 2021
05d2284
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-js in…
HarshaNalluru Apr 20, 2021
ce1f236
Merge branch 'harshan/recorder/filter-scope' of https://github.com/Ha…
HarshaNalluru Apr 21, 2021
43bc9a2
fix regexes and minor bugs
HarshaNalluru Apr 21, 2021
19dbec8
fix test titles and removed .only
HarshaNalluru Apr 21, 2021
478c7f4
remove requestBodyTransformations on the exports as it isn't well sup…
HarshaNalluru Apr 21, 2021
2332a82
InternalRecorderEnvironmentSetup with requestBodyTransformations
HarshaNalluru Apr 21, 2021
a139974
recording
HarshaNalluru Apr 21, 2021
fe26243
reasoning
HarshaNalluru Apr 21, 2021
901e574
applyRequestBodyTransformationsOnFixture
HarshaNalluru Apr 21, 2021
ff8dd0b
changelog
HarshaNalluru Apr 21, 2021
80794b7
minor bug fix
HarshaNalluru Apr 21, 2021
81b58cb
record a test from text-analytics
HarshaNalluru Apr 21, 2021
c6842ca
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-js in…
HarshaNalluru Apr 21, 2021
8a8e2a7
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-js in…
HarshaNalluru Apr 23, 2021
09af90c
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-js in…
HarshaNalluru Apr 23, 2021
fffdb55
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-js in…
HarshaNalluru May 12, 2021
8fc6629
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-js in…
HarshaNalluru May 12, 2021
051aeed
convert to Record<string, unknown>
HarshaNalluru May 12, 2021
dc46c22
rush update --recheck
HarshaNalluru May 12, 2021
822ac74
Required<RequestBodyTransformsType>
HarshaNalluru May 12, 2021
854ce6d
retain older changelog
HarshaNalluru May 12, 2021
07baf37
set the date
HarshaNalluru May 12, 2021
c9d66fd
Update sdk/test-utils/recorder/CHANGELOG.md
HarshaNalluru May 12, 2021
0f14c68
lock file
HarshaNalluru May 19, 2021
fedce31
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-js in…
HarshaNalluru May 22, 2021
0bdcad2
revert recording
HarshaNalluru May 22, 2021
1af5db3
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-js in…
HarshaNalluru May 25, 2021
b3b00dd
lock file
HarshaNalluru May 25, 2021
5c1b872
sanitizeScopeUrl
HarshaNalluru May 25, 2021
4d8fe5a
fix the regex
HarshaNalluru May 25, 2021
e002369
regenerate and playback - works
HarshaNalluru May 25, 2021
f627108
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-js in…
HarshaNalluru May 25, 2021
1c80a0f
rush update
HarshaNalluru May 25, 2021
bbffc88
changelog
HarshaNalluru May 25, 2021
f52eb97
tests for browser recordings
HarshaNalluru May 25, 2021
b4a22d7
tests for defaultCustomizationsOnRecordings
HarshaNalluru May 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
tests for defaultCustomizationsOnRecordings
  • Loading branch information
HarshaNalluru committed May 25, 2021
commit b4a22d755ab9d1bf29be55f0512d3ddc07f6b061
26 changes: 15 additions & 11 deletions sdk/test-utils/recorder/test/node/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import {
testHasChanged,
isContentTypeInNockFixture,
decodeHexEncodingIfExistsInNockFixture,
handleSingleQuotesInUrlPath,
maskAccessTokenInNockFixture
handleSingleQuotesInUrlPath
} from "../../src/utils";
import { nodeRequireRecordingIfExists, findRecordingsFolderPath } from "../../src/utils/recordings";
import chai, { expect } from "chai";
import { defaultCustomizationsOnRecordings } from "../../src/defaultCustomizations";

describe("NodeJS utils", () => {
describe("nodeRequireRecordingIfExists", () => {
Expand Down Expand Up @@ -398,10 +398,10 @@ describe("NodeJS utils", () => {
});
});

describe("Mask access tokens in nock fixtures", () => {
describe("defaultCustomizationsOnRecordings for nock fixtures", () => {
[
{
name: `mask "access_token"s in json response`,
name: `mask "access_token"s in json response and modify scope url`,
input: `nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true})
.post('/aaaaa/oauth2/v2.0/token', "response_type=token&grant_type=client_credentials&client_id=aaaaa&client_secret=aaaaa&scope=https%3A%2F%2Fstorage.azure.com%2F.default")
.reply(200, {"token_type":"Bearer","expires_in":86399,"ext_expires_in":86399,"access_token":"e6z-9_g"}, [
Expand All @@ -420,7 +420,7 @@ describe("NodeJS utils", () => {
'X-Content-Type-Options'
]);`,
output: `nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true})
.post('/aaaaa/oauth2/v2.0/token', "response_type=token&grant_type=client_credentials&client_id=aaaaa&client_secret=aaaaa&scope=https%3A%2F%2Fstorage.azure.com%2F.default")
.post('/aaaaa/oauth2/v2.0/token', "response_type=token&grant_type=client_credentials&client_id=aaaaa&client_secret=aaaaa&scope=https%3A%2F%2Fsanitized%2F")
.reply(200, {"token_type":"Bearer","expires_in":86399,"ext_expires_in":86399,"access_token":"access_token"}, [
'Cache-Control',
'no-store, no-cache',
Expand All @@ -438,7 +438,7 @@ describe("NodeJS utils", () => {
]);`
},
{
name: `do nothing for json response without access_token`,
name: `modify scope url and do nothing else for json response without access_token`,
input: `nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true})
.post('/aaaaa/oauth2/v2.0/token', "response_type=token&grant_type=client_credentials&client_id=aaaaa&client_secret=aaaaa&scope=https%3A%2F%2Fstorage.azure.com%2F.default")
.reply(200, {"token_type":"Bearer","expires_in":86399,"ext_expires_in":86399,"access_string":"e6z-9_g"}, [
Expand All @@ -457,7 +457,7 @@ describe("NodeJS utils", () => {
'X-Content-Type-Options'
]);`,
output: `nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true})
.post('/aaaaa/oauth2/v2.0/token', "response_type=token&grant_type=client_credentials&client_id=aaaaa&client_secret=aaaaa&scope=https%3A%2F%2Fstorage.azure.com%2F.default")
.post('/aaaaa/oauth2/v2.0/token', "response_type=token&grant_type=client_credentials&client_id=aaaaa&client_secret=aaaaa&scope=https%3A%2F%2Fsanitized%2F")
.reply(200, {"token_type":"Bearer","expires_in":86399,"ext_expires_in":86399,"access_string":"e6z-9_g"}, [
'Cache-Control',
'no-store, no-cache',
Expand All @@ -475,7 +475,7 @@ describe("NodeJS utils", () => {
]);`
},
{
name: `do nothing for non JSON response`,
name: `do nothing for (unrelated) non JSON response`,
input: `nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true})
.post('/path', "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><QueryRequest><Expression>select * from BlobStorage</Expression></QueryRequest>")
.query(true)
Expand All @@ -500,7 +500,7 @@ describe("NodeJS utils", () => {
]);`
},
{
name: "do nothing for XML response",
name: "do nothing for unrelated XML response",
input: `nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true})
.post('/', "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><KeyInfo><Start>2019-12-03T06:12:38Z</Start><Expiry>2019-12-04T05:12:38Z</Expiry></KeyInfo>")
.query(true)
Expand Down Expand Up @@ -540,10 +540,14 @@ describe("NodeJS utils", () => {
}
].forEach((test) => {
it(test.name, () => {
let updatedFixture = test.input;
for (const customization of defaultCustomizationsOnRecordings) {
updatedFixture = customization(updatedFixture);
}
chai.assert.equal(
maskAccessTokenInNockFixture(test.input),
updatedFixture,
test.output,
`Unexpected result - access_token is not masked`
`Unexpected result - updatedFixture is not as expected`
);
});
});
Expand Down