-
Couldn't load subscription status.
- Fork 2
Open
Description
The test test_zenodo_connection_success is failing with the following assertion error:
assert 0 == 200
This indicates that the connection check is not returning the expected status code from Zenodo. Likely related to a missing or invalid ZENODO_API_KEY in the test environment.
Goal:
Is to fix the failing test by ensuring the ZENODO_API_KEY is correctly set and that the connection to the Zenodo sandbox returns a 200 status code as expected.
Reference:
See failing run in PR #61: https://github.com/vre-hub/zenodo-jupyterlab-extension/actions/runs/15966940435/job/45029239241?pr=61
Logs:
============================= test session starts ==============================
platform linux -- Python 3.11.[13](https://github.com/vre-hub/zenodo-jupyterlab-extension/actions/runs/15966940435/job/45029239241?pr=61#step:12:14), pytest-8.4.1, pluggy-1.6.0
rootdir: /home/runner/work/zenodo-jupyterlab-extension/zenodo-jupyterlab-extension
configfile: pyproject.toml
plugins: asyncio-1.0.0, anyio-4.9.0
asyncio: mode=Mode.STRICT, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
collected 8 items
zenodo_jupyterlab/server/tests/test_search.py ...... [ 75%]
zenodo_jupyterlab/server/tests/test_testConnection.py F. [100%]
=================================== FAILURES ===================================
________________________ test_zenodo_connection_success ________________________
@pytest.mark.asyncio
async def test_zenodo_connection_success():
# Mock the ZenodoAPI instance and its method
""" mock_instance = MockZenodoAPI.return_value
mock_instance.query_user_deposits = Mock()
mock_instance.query_user_deposits.return_value.status_code = 200 """
# Mock the environment variable
with patch.dict(os.environ, {'ZENODO_API_KEY': os.environ['CI_ZENODO_API_KEY']}):
with patch.dict(os.environ, {'ZENODO_SANDBOX': "true"}):
# Call the function to test
status_code, zAPI = await checkZenodoConnection()
print(f"Returned status code: {status_code}")
# Assert the expected status code
> assert status_code == 200
E assert 0 == 200
zenodo_jupyterlab/server/tests/test_testConnection.py:[23](https://github.com/vre-hub/zenodo-jupyterlab-extension/actions/runs/15966940435/job/45029239241?pr=61#step:12:24): AssertionError
----------------------------- Captured stdout call -----------------------------
Returned status code: 0
=========================== short test summary info ============================
FAILED zenodo_jupyterlab/server/tests/test_testConnection.py::test_zenodo_connection_success - assert 0 == 200
========================= 1 failed, 7 passed in 1.09s ==========================
Metadata
Metadata
Assignees
Labels
No labels