diff --git a/tests/contrib/urllib3/test_urllib3.py b/tests/contrib/urllib3/test_urllib3.py index 2f0c447ee65..32bd7344d08 100644 --- a/tests/contrib/urllib3/test_urllib3.py +++ b/tests/contrib/urllib3/test_urllib3.py @@ -16,6 +16,8 @@ from tests.opentracer.utils import init_tracer from tests.utils import TracerTestCase from tests.utils import snapshot +from ddtrace.settings.asm import config as asm_config +from tests.utils import override_global_config # host:port of httpbin_local container @@ -535,7 +537,8 @@ def test_distributed_tracing_apm_opt_out_true(self): self.tracer.enabled = False with mock.patch( "urllib3.connectionpool.HTTPConnectionPool._make_request", side_effect=ValueError - ) as m_make_request: + ) as m_make_request, override_global_config(dict(_appsec_standalone_enabled=True, _asm_enabled=True)): + assert asm_config._apm_opt_out with pytest.raises(ValueError): self.http.request("GET", URL_200) @@ -582,7 +585,8 @@ def test_distributed_tracing_apm_opt_out_false(self): self.tracer.enabled = False with mock.patch( "urllib3.connectionpool.HTTPConnectionPool._make_request", side_effect=ValueError - ) as m_make_request: + ) as m_make_request, override_global_config(dict(_appsec_standalone_enabled=False, _asm_enabled=True)): + assert not asm_config._apm_opt_out with pytest.raises(ValueError): self.http.request("GET", URL_200)