Exemplo n.º 1
0
def test_sync_repo(test_data_env):
    repo = LocalFeedDataRepo.from_disk('test/data/feeds_repo')
    assert repo.has_metadata(), 'Repo should have metadata'
    assert repo.has_root(), 'Repo should have root dir already'
    with pytest.raises(Exception):
        DataFeeds.sync_from_fetched(repo, catalog_client=None)

    assert DataFeeds.sync_metadata(
        feed_client=test_data_env.feed_client) == empty_metadata_sync_result
    assert DataFeeds.sync_metadata(
        feed_client=test_data_env.feed_client,
        to_sync=['vulnerabilities'])[0].get('vulnerabilities') is not None
    assert DataFeeds.sync_from_fetched(repo, catalog_client=None)
Exemplo n.º 2
0
def test_sync_repo(test_data_env, test_data_path):
    feeds_repo_path = os.path.join(test_data_path, "feeds_repo")
    repo = LocalFeedDataRepo.from_disk(feeds_repo_path)
    assert repo.has_metadata(), "Repo should have metadata"
    assert repo.has_root(), "Repo should have root dir already"
    with pytest.raises(Exception):
        DataFeeds.sync_from_fetched(repo, catalog_client=None)

    assert (DataFeeds.sync_metadata(
        feed_client=test_data_env.feed_client) == empty_metadata_sync_result)
    assert (DataFeeds.sync_metadata(feed_client=test_data_env.feed_client,
                                    to_sync=["vulnerabilities"
                                             ])[0].get("vulnerabilities")
            is not None)
    assert DataFeeds.sync_from_fetched(repo, catalog_client=None)