Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FormRecognizer] Enable copy model test #9749

Merged
merged 5 commits into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ describe("FormTrainingClient NodeJS only", () => {
}
});

// TODO: re-enabling is tracked by https://github.com/azure/azure-sdk-for-js/issues/9072
it.skip("copies model", async function() {
it("copies model", async function() {
// for testing purpose, copy into the same resource
const resourceId = env.FORM_RECOGNIZER_TARGET_RESOURCE_ID;
const resourceRegion = env.FORM_RECOGNIZER_TARGET_RESOURCE_REGION;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ const replaceableVariables: { [k: string]: string } = {
FORM_RECOGNIZER_ENDPOINT: "https://endpoint/",
FORM_RECOGNIZER_TRAINING_CONTAINER_SAS_URL: "https://storageaccount/trainingdata?sastoken",
FORM_RECOGNIZER_TESTING_CONTAINER_SAS_URL: "https://storageaccount/testingdata?sastoken",
FORM_RECOGNIZER_TARGET_RESOURCE_REGION: "resource_region",
FORM_RECOGNIZER_TARGET_RESOURCE_ID: "resource_id"
FORM_RECOGNIZER_TARGET_RESOURCE_REGION: "westus2",
// fake resource id
FORM_RECOGNIZER_TARGET_RESOURCE_ID: "/subscriptions/e1367d46-77d4-4f57-8cfe-348edbdc84a3/resourceGroups/jstests/providers/Microsoft.CognitiveServices/accounts/jstests-fr"
};

export const testEnv = new Proxy(replaceableVariables, {
Expand All @@ -46,8 +47,10 @@ export const environmentSetup: RecorderEnvironmentSetup = {
replaceableVariables,
customizationsOnRecordings: [
(recording: string): string =>
recording.replace(/"access_token"\s?:\s?"[^"]*"/g, `"access_token":"access_token"`),
// If we put ENDPOINT in replaceableVariables above, it will not capture
recording.replace(/"access_token"\s?:\s?"[^"]*"/g, `"access_token":"access_token"`)
.replace(/"accessToken"\s?:\s?"[^"]*"/g, `"accessToken":"accessToken"`)
.replace(/"targetResourceId"\s?:\s?"[^"]*"/g, `"targetResourceId":"${replaceableVariables["FORM_RECOGNIZER_TARGET_RESOURCE_ID"]}"`),
// If we put ENDPOINT in replaceableVariables above, it will not capture
// the endpoint string used with nock, which will be expanded to
// https://<endpoint>:443/ and therefore will not match, so we have to do
// this instead.
Expand Down
2 changes: 1 addition & 1 deletion sdk/formrecognizer/test-resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"name": "S0"
},
"kind": "FormRecognizer",
"location": "[resourceGroup().location]",
"location": "[parameters('location')]",
"properties": {
"customSubDomainName": "[parameters('baseName')]"
}
Expand Down