Skip to content

Commit

Permalink
Add test for chk_url_to_update
Browse files Browse the repository at this point in the history
Against the case that there is an update made available
in the remote
  • Loading branch information
candleindark committed Oct 5, 2023
1 parent a71c7d8 commit 097237e
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions datalad_registry/tests/test_tasks/test_chk_url_to_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,20 @@ def mock_update_ds_clone(*_args, **_kwargs):

@pytest.mark.usefixtures("fix_datetime_now")
@pytest.mark.parametrize(
"repo_url_name, resulting_in_new_clone",
"repo_url_name, update_available, resulting_in_new_clone",
[
("repo_url_with_up_to_date_clone", False),
("repo_url_off_sync_by_new_default_branch", True),
("repo_url_with_up_to_date_clone", False, False),
("repo_url_outdated_by_new_file", True, False),
("repo_url_off_sync_by_new_default_branch", False, True),
],
)
def test_no_update_available(
self, repo_url_name, resulting_in_new_clone, request, flask_app
def test_success_return(
self,
repo_url_name,
update_available,
resulting_in_new_clone,
request,
flask_app,
):
"""
Test the case that the clone of the dataset in the local cache is up-to-date
Expand All @@ -125,7 +131,9 @@ def test_no_update_available(

assert (
chk_url_to_update(repo_url.id, repo_url.last_chk_dt)
is ChkUrlStatus.OK_CHK_ONLY
is ChkUrlStatus.OK_UPDATED
if update_available
else ChkUrlStatus.OK_CHK_ONLY
)

# Verify the state of the `repo_url` record after `chk_url_to_update`
Expand Down

0 comments on commit 097237e

Please sign in to comment.