Skip to content
Merged
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
1 change: 0 additions & 1 deletion rsconnect/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5688,7 +5688,6 @@ def remove_content_build(
metavar="TEXT",
help="Check the local build state of a specific content item. This flag can be passed multiple times.",
)
@click.option("--verbose", "-v", count=True, help="Enable verbose output. Use -vv for very verbose (debug) output.")
# todo: --format option (json, text)
@click.pass_context
def list_content_build(
Expand Down
25 changes: 25 additions & 0 deletions tests/test_main_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import shutil
import tarfile
import unittest
import warnings
from unittest import mock

import httpretty
Expand Down Expand Up @@ -118,6 +119,30 @@ def test_version(self):
self.assertEqual(result.exit_code, 0, result.output)
self.assertIn(VERSION, result.output)

def test_build_command_help_has_one_verbose_option(self):
for command in ("add", "rm", "ls", "history", "logs", "run"):
with self.subTest(command=command), warnings.catch_warnings(record=True) as caught:
warnings.simplefilter("always")
result = CliRunner().invoke(cli, ["content", "build", command, "--help"])
self.assertEqual(result.exit_code, 0, result.output)
self.assertEqual(result.output.count("--verbose"), 1, result.output)
self.assertFalse([warning for warning in caught if "used more than once" in str(warning.message)])

@httpretty.activate(verbose=True, allow_net_connect=False)
def test_build_list_verbosity(self):
register_uris(self.connect_server)
for option, count in (("--verbose", 1), ("-v", 1), ("-vv", 2)):
with self.subTest(option=option), mock.patch("rsconnect.main.set_verbosity") as set_verbosity:
args = ["content", "build", "ls", option]
apply_common_args(args, server=self.connect_server, key=self.api_key)
with warnings.catch_warnings(record=True) as caught:
warnings.simplefilter("always")
result = CliRunner().invoke(cli, args)
self.assertEqual(result.exit_code, 0, result.output)
self.assertIsInstance(json.loads(result.output), list)
self.assertFalse([warning for warning in caught if "used more than once" in str(warning.message)])
set_verbosity.assert_called_once_with(count)

@httpretty.activate(verbose=True, allow_net_connect=False)
def test_content_search(self):
register_uris(self.connect_server)
Expand Down
Loading