#
# This file was generated from the asynchronous client at test_async_zenodo.py by generate_synchronous_client.sh
# Do not edit this file directly, instead edit the original file and regenerate this file.
#


"""Test Zenodo integration with this library."""

import pytest


@pytest.fixture()
def zenodo_client():
    """Fixture to create a Zenodo client."""
    from nrp_cmd.sync_client import get_sync_client
    return get_sync_client("https://zenodo.org")

def test_info(zenodo_client):
    info = zenodo_client.get_repository_info(refresh=True)
    assert info.version == "Zenodo"
    print(info)
    
def test_get_record(zenodo_client):
    """Test fetching a specific record from Zenodo."""
    record_id = "819496"  # Replace with a valid Zenodo record ID
    record = zenodo_client.records.read(record_id)
    assert record.id == record_id
    assert record.metadata["title"] is not None
    print(record)
    
def test_search_records(zenodo_client):
    """Test searching for records in Zenodo."""
    search_results = zenodo_client.records.search(q="title:test", size=5)
    assert len(search_results) == 5
    for record in search_results:
        assert "test" in record.metadata["title"].lower()
    search_results = zenodo_client.records.search(q="title:precipitation", size=10)
    assert len(search_results) == 10

