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

[Test Proxy] Update migration guide and default add_sanitizer regex #20769

Merged
merged 1 commit into from
Sep 21, 2021
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
3 changes: 2 additions & 1 deletion doc/dev/test_proxy_migration_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ adding something like the following in the package's `conftest.py` file:
```python
from devtools_testutils import add_sanitizer

@pytest.fixture(scope="session")
# autouse=True will trigger this fixture on each pytest run, even if it's not explicitly used by a test method
@pytest.fixture(scope="session", autouse=True)
def sanitize_uris():
add_sanitizer(ProxyRecordingSanitizer.URI, value="fakeendpoint")
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ def add_sanitizer(sanitizer, **kwargs):
"""
request_args = {}
request_args["value"] = kwargs.get("value") or "fakevalue"
request_args["regex"] = kwargs.get("regex") or "[a-z]+(?=(?:-secondary)\\.(?:table|blob|queue)\\.core\\.windows\\.net)"
request_args["regex"] = (
kwargs.get("regex") or "(?<=\\/\\/)[a-z]+(?=(?:|-secondary)\\.(?:table|blob|queue)\\.core\\.windows\\.net)"
)
request_args["group_for_replace"] = kwargs.get("group_for_replace")

if sanitizer == ProxyRecordingSanitizer.URI:
Expand All @@ -62,7 +64,7 @@ def add_sanitizer(sanitizer, **kwargs):
json={
"regex": request_args["regex"],
"value": request_args["value"],
"groupForReplace": request_args["group_for_replace"]
"groupForReplace": request_args["group_for_replace"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to remove the extra ,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was actually added by black -- I think it's a style preference and shouldn't affect functionality

},
)

Expand Down