def test_deprecated_command_daemon_not_started(self): actual_output = StringIO() with contextlib.redirect_stdout(actual_output): main(["channel", "new", "@foo", "1.0"]) self.assertEqual( actual_output.getvalue().strip(), "channel_new is deprecated, using channel_create.\n" "Could not connect to daemon. Are you sure it's running?")
def shell(argv): actual_output = StringIO() with contextlib.redirect_stdout(actual_output): with contextlib.redirect_stderr(actual_output): try: main(argv) except SystemExit as e: print(e.args[0]) return actual_output.getvalue().strip()
def test_when_download_dir_non_writable_on_start_then_daemon_dies_with_helpful_msg( self): with tempfile.TemporaryDirectory() as download_dir: os.chmod( download_dir, mode=0o555 ) # makes download dir non-writable, readable and executable with self.assertRaisesRegex( PermissionError, f"The following directory is not writable: {download_dir}" ): cli.main(["start", "--download-dir", download_dir])
def test_cli_status_command_with_auth(self): actual_output = StringIO() with contextlib.redirect_stdout(actual_output): cli.main(["--api", "localhost:5299", "status"]) actual_output = actual_output.getvalue() self.assertIn("connection_status", actual_output)