Example #1
0
def test_get_topics():
    """Test the function get topics."""
    alt_list = GraphDB.get_topics_for_alt(
        graph_resp['result']['data'], insights_resp[0]['alternate_packages'])
    comp_list = GraphDB.get_topics_for_comp(
        graph_resp['result']['data'], insights_resp[0]['companion_packages'])

    assert alt_list is not None
    assert isinstance(alt_list, list)

    assert comp_list is not None
    assert isinstance(comp_list, list)
def test_filter_versions():
    """Test the function filter_versions for latest version."""
    input_stack = {"io.vertx:vertx-web": "3.4.2", "io.vertx:vertx-core": "3.4.2"}

    with open("tests/data/companion_pkg_graph.json", "r") as f:
        companion_packages_graph = json.load(f)

    g = GraphDB()
    filtered_comp_packages_graph, filtered_list = g.filter_versions(companion_packages_graph,
                                                                    input_stack)
    assert len(filtered_comp_packages_graph) > 0
    assert len(filtered_list) > 0
Example #3
0
def test_prepare_final_filtered_list():
    """Test the function filter_versions."""
    with open("tests/data/companion_pkg_graph_deps.json", "r") as f:
        comp_pkg_graph = json.load(f)
        deps_pkg_graph = comp_pkg_graph['deps']
        release_pkg_graph = comp_pkg_graph['gh_release']

    g = GraphDB()
    filtered_list = g.prepare_final_filtered_list(deps_pkg_graph)
    assert len(filtered_list) > 0

    filtered_list = g.prepare_final_filtered_list(release_pkg_graph)
    assert len(filtered_list) > 0
def test_get_topmost_alternate():
    """Test the function get topmost alternate recommendation."""
    input_stack = {"io.vertx:vertx-core": "3.4.1"}
    alternate_packages, final_dict = GraphDB.get_topmost_alternate(insights_resp[0], input_stack)

    assert alternate_packages is not None
    assert isinstance(alternate_packages, list)
    assert final_dict is not None
    assert isinstance(final_dict, dict)
def test_get_version_information(_mock1, _mock2):
    """Test the function get_version_information."""
    out = GraphDB().get_version_information([], 'maven')
    assert len(out) == 0
Example #6
0
def test_get_version_information(_mock1):
    """Test the function get_version_information."""
    out = GraphDB().get_version_information(['io.vertx:vertx-web'], 'maven')
    assert len(out) == 1