Skip to content

Commit

Permalink
fix cli list packages (#1852)
Browse files Browse the repository at this point in the history
* fix cli list packages

* add cli list-package test

* add cli changelog entry

* update test
  • Loading branch information
cosmic-byte authored Oct 13, 2020
1 parent 9ceb8e6 commit bf6ba22
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion api/python/quilt3/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
13 changes: 13 additions & 0 deletions api/python/tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import tempfile
from pathlib import Path
from unittest import mock
from unittest.mock import patch

import pytest

Expand Down Expand Up @@ -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
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,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

Expand Down

0 comments on commit bf6ba22

Please sign in to comment.