Skip to content

Commit

Permalink
Merge pull request #169 from tisnik/fix-issue-160
Browse files Browse the repository at this point in the history
Fix issue #160
  • Loading branch information
tisnik authored Mar 21, 2019
2 parents 4064df1 + 44b3cba commit 70fc7f8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
from src.utils import (
DatabaseIngestion, alert_user, fetch_public_key, get_session, get_session_retry,
retrieve_worker_result, scan_repo, server_run_flow, validate_request_data,
fix_gremlin_output, generate_comparison, get_first_query_result
fix_gremlin_output, generate_comparison, get_first_query_result, get_parser_from_ecosystem
)

from src.parsers.maven_parser import MavenParser
from src.parsers.node_parser import NodeParser

from unittest.mock import patch
import requests
import pytest
Expand Down Expand Up @@ -335,3 +338,11 @@ def test_get_first_query_result():

# now first() was called, so check it
assert query_result_mock.get_first_called()


def test_get_parser_from_ecosystem():
"""Test the function get_parser_from_ecosystem()."""
assert get_parser_from_ecosystem(None) is None
assert get_parser_from_ecosystem("unknown") is None
assert get_parser_from_ecosystem("maven").__name__ == MavenParser.__name__
assert get_parser_from_ecosystem("npm").__name__ == NodeParser.__name__

0 comments on commit 70fc7f8

Please sign in to comment.