コード例 #1
0
 def test_cli_status_command_with_auth(self):
     self.assertFalse(self.daemon._use_authentication)
     actual_output = StringIO()
     with contextlib.redirect_stdout(actual_output):
         cli.main(["status"])
     actual_output = actual_output.getvalue()
     self.assertIn("connection_status", actual_output)
コード例 #2
0
ファイル: test_cli.py プロジェクト: walidmujahid/lbry
 def test_help_for_command_command(self):
     actual_output = StringIO()
     with contextlib.redirect_stdout(actual_output):
         main(['help', 'publish'])
     actual_output = actual_output.getvalue()
     self.assertSubstring('Make a new name claim and publish', actual_output)
     self.assertSubstring('Usage:', actual_output)
コード例 #3
0
ファイル: test_cli.py プロジェクト: walidmujahid/lbry
 def test_help_command(self):
     actual_output = StringIO()
     with contextlib.redirect_stdout(actual_output):
         main(['help'])
     actual_output = actual_output.getvalue()
     self.assertSubstring('lbrynet - LBRY command line client.', actual_output)
     self.assertSubstring('USAGE', actual_output)
コード例 #4
0
 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?")
コード例 #5
0
 def test_deprecated_command_daemon_not_started(self):
     actual_output = StringIO()
     with contextlib.redirect_stdout(actual_output):
         main(["wallet", "balance"])
     self.assertEqual(
         actual_output.getvalue().strip(),
         "wallet_balance is deprecated, using account_balance.\n"
         "Could not connect to daemon. Are you sure it's running?")
コード例 #6
0
ファイル: test_cli.py プロジェクト: walidmujahid/lbry
 def test_valid_command_daemon_not_started(self):
     actual_output = StringIO()
     with contextlib.redirect_stdout(actual_output):
         main(["publish", '--name=asd', '--bid=99'])
     self.assertEqual(
         actual_output.getvalue().strip(),
         "Could not connect to daemon. Are you sure it's running?"
     )
コード例 #7
0
ファイル: test_cli.py プロジェクト: walidmujahid/lbry
 def test_invalid_command(self):
     actual_output = StringIO()
     with contextlib.redirect_stdout(actual_output):
         main(['publish1'])
     self.assertEqual(
         actual_output.getvalue().strip(),
         "publish1 is not a valid command."
     )
コード例 #8
0
ファイル: test_cli.py プロジェクト: walidmujahid/lbry
 def test_version_command(self):
     actual_output = StringIO()
     with contextlib.redirect_stdout(actual_output):
         main(['version'])
     self.assertEqual(
         actual_output.getvalue().strip(),
         "lbrynet {lbrynet_version}".format(**get_platform())
     )
コード例 #9
0
 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()
コード例 #10
0
ファイル: test_cli.py プロジェクト: walidmujahid/lbry
 def test_help_for_command_command_with_invalid_command(self):
     actual_output = StringIO()
     with contextlib.redirect_stdout(actual_output):
         main(['help', 'publish1'])
     self.assertSubstring('Invalid command name', actual_output.getvalue())
コード例 #11
0
ファイル: test_cli.py プロジェクト: woolf-wen/lbry
 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)