Skip to content

Commit f8ff686

Browse files
authored
Update add_sanitizer and doc (Azure#20769)
1 parent 0e20469 commit f8ff686

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

doc/dev/test_proxy_migration_guide.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ adding something like the following in the package's `conftest.py` file:
108108
```python
109109
from devtools_testutils import add_sanitizer
110110

111-
@pytest.fixture(scope="session")
111+
# autouse=True will trigger this fixture on each pytest run, even if it's not explicitly used by a test method
112+
@pytest.fixture(scope="session", autouse=True)
112113
def sanitize_uris():
113114
add_sanitizer(ProxyRecordingSanitizer.URI, value="fakeendpoint")
114115
```

tools/azure-sdk-tools/devtools_testutils/azure_recorded_testcase.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ def add_sanitizer(sanitizer, **kwargs):
5252
"""
5353
request_args = {}
5454
request_args["value"] = kwargs.get("value") or "fakevalue"
55-
request_args["regex"] = kwargs.get("regex") or "[a-z]+(?=(?:-secondary)\\.(?:table|blob|queue)\\.core\\.windows\\.net)"
55+
request_args["regex"] = (
56+
kwargs.get("regex") or "(?<=\\/\\/)[a-z]+(?=(?:|-secondary)\\.(?:table|blob|queue)\\.core\\.windows\\.net)"
57+
)
5658
request_args["group_for_replace"] = kwargs.get("group_for_replace")
5759

5860
if sanitizer == ProxyRecordingSanitizer.URI:
@@ -62,7 +64,7 @@ def add_sanitizer(sanitizer, **kwargs):
6264
json={
6365
"regex": request_args["regex"],
6466
"value": request_args["value"],
65-
"groupForReplace": request_args["group_for_replace"]
67+
"groupForReplace": request_args["group_for_replace"],
6668
},
6769
)
6870

0 commit comments

Comments
 (0)