Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use new http get wrapper in oracle provider #386

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/vunnel/providers/oracle/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import os
import re

import requests

from vunnel import utils
from vunnel.utils import rpm
from vunnel.utils import http, rpm
from vunnel.utils.oval_parser import Config, parse

# One time initialization of driver specific configuration
Expand Down Expand Up @@ -65,11 +62,10 @@ def __init__(self, workspace, config=None, download_timeout=125, logger=None):
def urls(self):
return [self._url_]

@utils.retry_with_backoff()
def _download(self):
try:
self.logger.info(f"downloading ELSA from {self._url_}")
r = requests.get(self._url_, stream=True, timeout=self.download_timeout)
r = http.get(self._url_, self.logger, stream=True, timeout=self.download_timeout)
if r.status_code != 200:
raise Exception(f"GET {self._url_} failed with HTTP error {r.status_code}")

Expand Down
8 changes: 0 additions & 8 deletions tests/unit/providers/oracle/test_oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,14 +361,6 @@ def test_filterer(self, input_vulnerability, expected_output):
assert f.filter(input_vulnerability) == expected_output


@pytest.fixture()
def disable_get_requests(monkeypatch):
def disabled(*args, **kwargs):
raise RuntimeError("requests disabled but HTTP GET attempted")

monkeypatch.setattr(parser.requests, "get", disabled)


def test_provider_schema(helpers, disable_get_requests, monkeypatch):
workspace = helpers.provider_workspace_helper(name=Provider.name())

Expand Down
Loading