def test_get_ca_cert_none_on_fail(): with mock.patch('requests.get') as req, \ mock.patch('builtins.print') as prn: req.return_value.ok = False ca_bundle = agent.get_ca_cert() assert ca_bundle is None assert mock.call('Failed to get CA...') in prn.mock_calls assert prn.call_count == 3
def test_get_ca_cert(): ca_bundle = agent.get_ca_cert() assert "BEGIN CERTIFICATE" in ca_bundle