forked from LBRYCommunity/lbry-sdk
Fixed regression in unauthenticated API client w/ integration tests
This commit is contained in:
parent
49c659b832
commit
8c6c442fdd
2 changed files with 32 additions and 1 deletions
|
@ -25,8 +25,10 @@ async def execute_command(method, params, conf_path=None):
|
|||
# this actually executes the method
|
||||
try:
|
||||
resp = await api.call(method, params)
|
||||
if not api.session.closed:
|
||||
try:
|
||||
await api.session.close()
|
||||
except AttributeError:
|
||||
pass
|
||||
print(json.dumps(resp["result"], indent=2))
|
||||
except KeyError:
|
||||
if resp["error"]["code"] == -32500:
|
||||
|
|
|
@ -40,3 +40,32 @@ class AuthCLIIntegrationTest(unittest.TestCase):
|
|||
@defer.inlineCallbacks
|
||||
def tearDown(self):
|
||||
yield self.daemon._shutdown()
|
||||
|
||||
|
||||
class UnAuthCLIIntegrationTest(unittest.TestCase):
|
||||
@defer.inlineCallbacks
|
||||
def setUp(self):
|
||||
skip = [
|
||||
DATABASE_COMPONENT, BLOB_COMPONENT, HEADERS_COMPONENT, WALLET_COMPONENT,
|
||||
DHT_COMPONENT, HASH_ANNOUNCER_COMPONENT, STREAM_IDENTIFIER_COMPONENT, FILE_MANAGER_COMPONENT,
|
||||
PEER_PROTOCOL_SERVER_COMPONENT, REFLECTOR_COMPONENT, UPNP_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT,
|
||||
RATE_LIMITER_COMPONENT, PAYMENT_RATE_COMPONENT
|
||||
]
|
||||
conf.initialize_settings(load_conf_file=False)
|
||||
conf.settings["components_to_skip"] = skip
|
||||
conf.settings.initialize_post_conf_load()
|
||||
Daemon.component_attributes = {}
|
||||
self.daemon = Daemon()
|
||||
yield self.daemon.start_listening()
|
||||
|
||||
def test_cli_status_command_with_auth(self):
|
||||
self.assertTrue(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)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def tearDown(self):
|
||||
yield self.daemon._shutdown()
|
||||
|
|
Loading…
Add table
Reference in a new issue