def test_fetch_indicators_rate_limiting(requests_mock, response_429): """ Given: - the IP reputation feed When: - running fetch-indicators - a 429 Rate Limited response from the API Then: - a DemistoException is raised """ base_url = "https://cyren.feed/" requests_mock.get( base_url + "data?format=jsonl&feedId=ip_reputation&offset=0&count=10", text=response_429, status_code=429) requests_mock.get(base_url + "info?format=jsonl&feedId=ip_reputation", json=dict(startOffset=0, endOffset=0)) client = Client(feed_name="ip_reputation", base_url=base_url, verify=False, proxy=False) with pytest.raises(DemistoException, match=f".*{response_429}.*"): fetch_indicators_command(client, 0, 10, False)
def test_fetch_indicators_rate_limiting(requests_mock, response_429): """ Given: - the IP reputation feed When: - running fetch-indicators - a 429 Rate Limited response from the API Then: - a DemistoException is raised """ requests_mock.get( BASE_URL + "/data?format=jsonl&feedId=ip_reputation&offset=0&count=10", request_headers=_expected_headers(), text=response_429, status_code=429) requests_mock.get(BASE_URL + "/info?format=jsonl&feedId=ip_reputation", json=dict(startOffset=0, endOffset=0), request_headers=_expected_headers()) client = _create_client("ip_reputation") with pytest.raises(DemistoException, match=f".*{response_429}.*"): fetch_indicators_command(client, 0, 10, False)
def fetch_command(initial_count=0, max_indicators=2, update_context=False): return fetch_indicators_command(client, initial_count, max_indicators, update_context)