Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions audius/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ def hosts():
List available hosts.
"""

gen = (f"{x}\n" for x in get_hosts())
click.echo_via_pager(gen)
all_hosts = list(get_hosts())
for host in all_hosts:
click.echo(host)

cli.add_command(users(sdk_cls))
cli.add_command(playlists(sdk_cls))
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
extras_require = {
"test": [
"pytest>=7.0",
"pytest-mock",
],
"lint": [
"black>=24.10.0",
Expand Down
13 changes: 13 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,16 @@ def test_cli(runner, cli):
def test_app_name(runner, cli):
result = runner.invoke(cli, ["config", "app-name"])
assert result.output == "audius-py\n"


def test_hosts(mocker, runner, cli):
hosts_patch = mocker.patch("audius.cli.get_hosts")
hosts = ["http://host1.example.com", "https://host2.example.com"]

def patch():
yield from hosts

hosts_patch.side_effect = patch

result = runner.invoke(cli, "hosts")
assert result.output == "\n".join(hosts) + "\n"