Skip to content

Commit

Permalink
unit test fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Whitehead <[email protected]>
  • Loading branch information
andrewwhitehead committed Aug 8, 2019
1 parent 4853b42 commit 30f8d8e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
17 changes: 10 additions & 7 deletions aries_cloudagent/commands/provision.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
from typing import Sequence

from ..config import argparse as arg
from ..config.base import BaseError
from ..config.default_context import DefaultContextBuilder
from ..config.ledger import ledger_config
from ..config.wallet import wallet_config
from ..config.util import common_config
from ..error import BaseError
from ..config.wallet import wallet_config


class ProvisionError(BaseError):
Expand All @@ -28,12 +28,15 @@ async def provision(settings: dict):
context_builder = DefaultContextBuilder(settings)
context = await context_builder.build()

public_did = await wallet_config(context, True)
try:
public_did = await wallet_config(context, True)

if await ledger_config(context, public_did, True):
print("Ledger configured")
else:
print("Ledger not configured")
if await ledger_config(context, public_did, True):
print("Ledger configured")
else:
print("Ledger not configured")
except BaseError as e:
raise ProvisionError("Error during provisioning") from e


def execute(argv: Sequence[str] = None):
Expand Down
6 changes: 3 additions & 3 deletions aries_cloudagent/commands/tests/test_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ async def test_run_loop(self):
with async_mock.patch.object(command, "asyncio", autospec=True) as mock_asyncio:
command.run_loop(startup_call, shutdown_call)
mock_asyncio.get_event_loop.return_value.add_signal_handler.assert_called_once()
mock_asyncio.ensure_future.assert_called_once_with(
startup_call, loop=mock_asyncio.get_event_loop.return_value
)
init_coro = mock_asyncio.ensure_future.call_args[0][0]
mock_asyncio.get_event_loop.return_value.run_forever.assert_called_once()
await init_coro
startup.assert_awaited_once()

done_calls = (
mock_asyncio.get_event_loop.return_value.add_signal_handler.call_args
Expand Down

0 comments on commit 30f8d8e

Please sign in to comment.