Skip to content

Commit dec737c

Browse files
committed
Add capath to tests
1 parent 9df0c23 commit dec737c

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

tests/agent_unittests/test_agent_protocol.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def test_send(status_code):
170170
HttpClientRecorder.STATUS_CODE = status_code
171171
settings = finalize_application_settings(
172172
{
173-
"request_headers_map": {"custom-header": u"value"},
173+
"request_headers_map": {"custom-header": "value"},
174174
"agent_run_id": "RUN_TOKEN",
175175
}
176176
)
@@ -196,7 +196,7 @@ def test_send(status_code):
196196

197197
assert request.headers == {
198198
"Content-Type": "application/json",
199-
"custom-header": u"value",
199+
"custom-header": "value",
200200
}
201201

202202
assert request.payload == b"[1,2,3]"
@@ -297,7 +297,7 @@ def connect_payload_asserts(
297297
with_kubernetes=True,
298298
):
299299
payload_data = payload[0]
300-
assert isinstance(payload_data["agent_version"], type(u""))
300+
assert isinstance(payload_data["agent_version"], type(""))
301301
assert payload_data["app_name"] == PAYLOAD_APP_NAME
302302
assert payload_data["display_host"] == DISPLAY_NAME
303303
assert payload_data["environment"] == ENVIRONMENT
@@ -565,6 +565,7 @@ def test_ca_bundle_path(monkeypatch, ca_bundle_path):
565565
# Pretend CA certificates are not available
566566
class DefaultVerifyPaths(object):
567567
cafile = None
568+
capath = None
568569

569570
def __init__(self, *args, **kwargs):
570571
pass

tests/agent_unittests/test_http_client.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def test_http_payload_compression(server, client_cls, method, threshold):
314314
]
315315
assert internal_metrics["Supportability/Python/Collector/Output/Bytes"][:2] == [
316316
2,
317-
len(payload)*2,
317+
len(payload) * 2,
318318
]
319319

320320
if threshold < 20:
@@ -324,8 +324,8 @@ def test_http_payload_compression(server, client_cls, method, threshold):
324324

325325
# Verify the compressed payload length is recorded
326326
assert internal_metrics["Supportability/Python/Collector/method1/ZLIB/Bytes"][:2] == [1, payload_byte_len]
327-
assert internal_metrics["Supportability/Python/Collector/ZLIB/Bytes"][:2] == [2, payload_byte_len*2]
328-
327+
assert internal_metrics["Supportability/Python/Collector/ZLIB/Bytes"][:2] == [2, payload_byte_len * 2]
328+
329329
assert len(internal_metrics) == 8
330330
else:
331331
# Verify no ZLIB compression metrics were sent
@@ -366,11 +366,14 @@ def test_cert_path(server):
366366
def test_default_cert_path(monkeypatch, system_certs_available):
367367
if system_certs_available:
368368
cert_file = "foo"
369+
ca_path = "/usr/certs"
369370
else:
370371
cert_file = None
372+
ca_path = None
371373

372374
class DefaultVerifyPaths(object):
373375
cafile = cert_file
376+
capath = ca_path
374377

375378
def __init__(self, *args, **kwargs):
376379
pass

0 commit comments

Comments
 (0)