Temporarily ceasing console logging right before click invocation.

pull/2712/head
jMyles 2019-09-21 19:40:28 -07:00
parent bd679888d9
commit e73e1e5765
1 changed files with 11 additions and 0 deletions

View File

@ -32,6 +32,7 @@ def test_bob_public_keys(click_runner):
assert "bob_verifying_key" in result.output
from nucypher.crypto.kits import UmbralMessageKit
from nucypher.crypto.powers import SigningPower
from nucypher.utilities.logging import GlobalLoggerSettings
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD, TEMPORARY_DOMAIN
from nucypher.utilities.sandbox.constants import MOCK_IP_ADDRESS, MOCK_CUSTOM_INSTALLATION_PATH
@ -177,13 +178,19 @@ def test_bob_retrieves_twice_via_cli(click_runner,
this_fuckin_guy.controller.emitter = JSONRPCStdoutEmitter()
return this_fuckin_guy
_old_make_character_function = actions.make_cli_character
try:
log.info("Patching make_cli_character with substitute_bob")
actions.make_cli_character = substitute_bob
# Once...
# TODO: Add invocation wrapper #1353
GlobalLoggerSettings.stop_console_logging()
retrieve_response = click_runner.invoke(nucypher_cli, retrieve_args, catch_exceptions=False, env=envvars)
GlobalLoggerSettings.start_console_logging()
log.info(f"First retrieval response: {retrieve_response.output}")
assert retrieve_response.exit_code == 0
@ -192,7 +199,11 @@ def test_bob_retrieves_twice_via_cli(click_runner,
assert cleartext.encode() == capsule_side_channel.plaintexts[1]
# and again!
# TODO: Add invocation wrapper #1353
GlobalLoggerSettings.stop_console_logging()
retrieve_response = click_runner.invoke(nucypher_cli, retrieve_args, catch_exceptions=False, env=envvars)
GlobalLoggerSettings.start_console_logging()
log.info(f"Second retrieval response: {retrieve_response.output}")
assert retrieve_response.exit_code == 0