Exemple #1
0
def test_cve_search(requests_mock):
    requests_mock.get(f'{MOCK_BASE_URL}/vulnerabilities/fulltext?q={MOCK_CVE_QUERY}', json=MOCK_CVE_SEARCH_RESP)

    client = Client(MOCK_BASE_URL, MOCK_API_KEY, MOCK_PASSWORD, True, False)
    _, outputs, _ = cve_search_command(client, {'q': MOCK_CVE_QUERY})

    assert outputs['XFE.CVESearch']['TotalRows'] == len(outputs[outputPaths['cve']]), 'Mismatch rows and outputs'
Exemple #2
0
def test_cve_latest(requests_mock):
    requests_mock.get(f'{MOCK_BASE_URL}/vulnerabilities',
                      json=MOCK_RECENT_CVE_RESP)

    client = Client(MOCK_BASE_URL, MOCK_API_KEY, MOCK_PASSWORD, True, False)
    _, outputs, _ = cve_search_command(client, {})
    assert len(
        outputs[outputPaths['cve']]) == 1, 'CVE output length should be 1'