Skip to content

Commit

Permalink
Rename DataSource -> Importer
Browse files Browse the repository at this point in the history
Signed-off-by: Hritik Vijay <[email protected]>
  • Loading branch information
Hritik14 committed Feb 8, 2022
1 parent 62a2789 commit e6d652c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions vulnerabilities/importers/mozilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
from markdown import markdown
from packageurl import PackageURL

from vulnerabilities.data_source import Advisory
from vulnerabilities.data_source import GitDataSource
from vulnerabilities.data_source import Reference
from vulnerabilities.data_source import VulnerabilitySeverity
from vulnerabilities.importer import Advisory
from vulnerabilities.importer import GitImporter
from vulnerabilities.importer import Reference
from vulnerabilities.importer import VulnerabilitySeverity
from vulnerabilities.helpers import is_cve
from vulnerabilities.helpers import split_markdown_front_matter
from vulnerabilities.severity_systems import scoring_systems
from vulnerabilities.severity_systems import SCORING_SYSTEMS

REPOSITORY = "mozilla/foundation-security-advisories"
MFSA_FILENAME_RE = re.compile(r"mfsa(\d{4}-\d{2,3})\.(md|yml)$")


class MozillaDataSource(GitDataSource):
class MozillaImporter(GitImporter):
def __enter__(self):
super(MozillaDataSource, self).__enter__()
super(MozillaImporter, self).__enter__()

if not getattr(self, "_added_files", None):
self._added_files, self._updated_files = self.file_changes(
Expand Down
10 changes: 5 additions & 5 deletions vulnerabilities/tests/test_mozilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
TEST_DATA = os.path.join(BASE_DIR, "test_data/")


@patch("vulnerabilities.importers.MozillaDataSource._update_from_remote")
@patch("vulnerabilities.importers.MozillaImporter._update_from_remote")
class MozillaImportTest(TestCase):

tempdir = None
Expand All @@ -31,7 +31,7 @@ def setUpClass(cls) -> None:
name="mozilla_unittests",
license="",
last_run=None,
data_source="MozillaDataSource",
data_source="MozillaImporter",
data_source_cfg={
"repository_url": "https://example.git",
"working_directory": os.path.join(cls.tempdir, "mozilla_test"),
Expand All @@ -48,9 +48,9 @@ def tearDownClass(cls) -> None:
def test_import(self, _):
runner = ImportRunner(self.importer, 100)

# Remove if we don't need set_api in MozillaDataSource
# with patch("vulnerabilities.importers.MozillaDataSource.versions", new=MOCK_VERSION_API):
# with patch("vulnerabilities.importers.MozillaDataSource.set_api"):
# Remove if we don't need set_api in MozillaImporter
# with patch("vulnerabilities.importers.MozillaImporter.versions", new=MOCK_VERSION_API):
# with patch("vulnerabilities.importers.MozillaImporter.set_api"):
# runner.run()
runner.run()

Expand Down

0 comments on commit e6d652c

Please sign in to comment.