diff --git a/api/python/quilt3/main.py b/api/python/quilt3/main.py index f43cb4f5987..cf24513f163 100644 --- a/api/python/quilt3/main.py +++ b/api/python/quilt3/main.py @@ -206,7 +206,7 @@ def cmd_disable_telemetry(): def cmd_list_packages(registry): - for package_name in get_package_registry(registry).list_packages: + for package_name in get_package_registry(registry).list_packages(): print(package_name) diff --git a/api/python/tests/test_cli.py b/api/python/tests/test_cli.py index ec99c65a8a3..b4879fa2353 100644 --- a/api/python/tests/test_cli.py +++ b/api/python/tests/test_cli.py @@ -1,6 +1,7 @@ import tempfile from pathlib import Path from unittest import mock +from unittest.mock import patch import pytest @@ -89,3 +90,15 @@ def test_push_with_meta_data( # check for expected stderr exception message captured = capsys.readouterr() assert expected_stderr in captured.err + + +def test_list_packages(capsys): + registry = 's3://my_test_bucket/' + pkg_names = ['foo/bar', 'foo/bar1', 'foo1/bar'] + with patch('quilt3.backends.s3.S3PackageRegistryV1.list_packages') as list_packages_mock: + list_packages_mock.return_value = pkg_names + main.main(('list-packages', registry)) + + list_packages_mock.assert_called_once_with() + captured = capsys.readouterr() + assert captured.out.split() == pkg_names diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 5482de62e2f..800193769b7 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -15,6 +15,8 @@ ## CLI * [Added] Add `meta` argument to the push command ([#1793](https://github.com/quiltdata/quilt/issues/1793)) +* [Fixed] Fix a crash of `list-packages` command + ([#1852](https://github.com/quiltdata/quilt/issues/1852)) ## Catalog