def test_ssl_cert_search_command_success(mocker_http_request, client): """ When "ssl-cert-search" command executes successfully then context output and response should match. """ from PassiveTotal_v2 import ssl_cert_search_command # Fetching expected raw response from file with open('test_data/SSL/ssl_cert_resp.json', encoding='utf-8') as f: json_file = json.load(f) expected_res = json_file.get('success') mocker_http_request.return_value = expected_res # Fetching expected entry context details from file with open("test_data/SSL/ssl_cert_ec.json", encoding='utf-8') as f: expected_ec = json.load(f) # Fetching expected entry context details from file with open("test_data/SSL/ssl_cert_hr.md") as f: expected_hr = f.read() result = ssl_cert_search_command(client, SSL_ARGS) assert result.raw_response == expected_res assert result.outputs == expected_ec assert result.readable_output == expected_hr assert result.outputs_key_field == 'sha1' assert result.outputs_prefix == 'PassiveTotal.SSL'
def test_ssl_cert_search_no_record_found(mocker_http_request, client): """ When no record found from SSL response then result string should match. """ from PassiveTotal_v2 import ssl_cert_search_command # Fetching expected raw response from file with open("test_data/SSL/ssl_cert_resp.json", encoding='utf-8') as f: json_file = json.load(f) expected_res = json_file.get('zeroRecords') mocker_http_request.return_value = expected_res result = ssl_cert_search_command(client, SSL_ARGS) assert result == 'No SSL certificate(s) were found for the given argument(s).'