|
51 | 51 |
|
52 | 52 | API_BASE = "/api/apps/alerts" |
53 | 53 | BEARER_HEADERS = {"Authorization": "Bearer test-token"} |
| 54 | +#: The parent of every logger the request path emits through. Naming it keeps the |
| 55 | +#: "no record carries the secret" assertions from passing on an empty capture. |
| 56 | +_APP_LOGGER = "app" |
54 | 57 |
|
55 | 58 |
|
56 | 59 | _TEMPLATE_A = AlertTemplate( |
@@ -331,7 +334,7 @@ def test_pagerduty_integration_key_with_control_chars_not_echoed( |
331 | 334 | receiver="default", routes=[] |
332 | 335 | ) |
333 | 336 | bad_key = "key\x00\nctrl" |
334 | | - with caplog.at_level("DEBUG"): |
| 337 | + with caplog.at_level("DEBUG", logger=_APP_LOGGER): |
335 | 338 | response = api_client.post( |
336 | 339 | f"{API_BASE}/pagerduty", json={"integration_key": bad_key} |
337 | 340 | ) |
@@ -605,7 +608,7 @@ def test_does_not_log_integration_key(self, api_client, mock_pmm_api, caplog): |
605 | 608 | mock_pmm_api.get_notification_policy.return_value = NotificationPolicy( |
606 | 609 | receiver="default", routes=[] |
607 | 610 | ) |
608 | | - with caplog.at_level("DEBUG"): |
| 611 | + with caplog.at_level("DEBUG", logger=_APP_LOGGER): |
609 | 612 | response = api_client.post( |
610 | 613 | f"{API_BASE}/pagerduty", |
611 | 614 | json={"integration_key": "supersecretkey-xyz"}, |
@@ -719,7 +722,7 @@ def test_delete_does_not_log_integration_key( |
719 | 722 | mock_pmm_api.get_notification_policy.return_value = NotificationPolicy( |
720 | 723 | receiver="default", routes=[] |
721 | 724 | ) |
722 | | - with caplog.at_level("DEBUG"): |
| 725 | + with caplog.at_level("DEBUG", logger=_APP_LOGGER): |
723 | 726 | response = api_client.post(f"{API_BASE}/pagerduty/delete") |
724 | 727 | assert response.status_code == status.HTTP_200_OK |
725 | 728 | for record in caplog.records: |
|
0 commit comments