Skip to content

Commit

Permalink
Merge pull request #739 from ianco/args_updates
Browse files Browse the repository at this point in the history
Aca-py startup arg updates
  • Loading branch information
andrewwhitehead authored Oct 7, 2020
2 parents 015928f + 2b6fe81 commit 1f9a3bc
Show file tree
Hide file tree
Showing 13 changed files with 311 additions and 62 deletions.
2 changes: 1 addition & 1 deletion aries_cloudagent/commands/help.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Help command for indexing available commands."""

from argparse import ArgumentParser
from configargparse import ArgumentParser
from typing import Sequence

from ..version import __version__
Expand Down
2 changes: 1 addition & 1 deletion aries_cloudagent/commands/provision.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Provision command for setting up agent settings before starting."""

import asyncio
from argparse import ArgumentParser
from configargparse import ArgumentParser
from typing import Sequence

from ..config import argparse as arg
Expand Down
2 changes: 1 addition & 1 deletion aries_cloudagent/commands/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import logging
import os
import signal
from argparse import ArgumentParser
from configargparse import ArgumentParser
from typing import Coroutine, Sequence

try:
Expand Down
17 changes: 15 additions & 2 deletions aries_cloudagent/commands/tests/test_provision.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
from asynctest import mock as async_mock
import pytest

from ...config.error import ArgsParseError
from .. import provision as command


class TestProvision(AsyncTestCase):
def test_bad_calls(self):
with self.assertRaises(command.ProvisionError):
with self.assertRaises(ArgsParseError):
command.execute([])

with self.assertRaises(SystemExit):
Expand All @@ -16,7 +17,19 @@ def test_bad_calls(self):
@pytest.mark.indy
def test_provision_wallet(self):
test_seed = "testseed000000000000000000000001"
command.execute(["--wallet-type", "indy", "--seed", test_seed])
command.execute(
[
"--wallet-type",
"indy",
"--wallet-name",
"test_wallet",
"--wallet-key",
"key",
"--seed",
test_seed,
"--no-ledger",
]
)

async def test_provision_ledger_configured(self):
with async_mock.patch.object(
Expand Down
24 changes: 17 additions & 7 deletions aries_cloudagent/commands/tests/test_start.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
from asynctest import TestCase as AsyncTestCase
from asynctest import mock as async_mock

from ...config.error import ArgsParseError
from .. import start as command


class TestStart(AsyncTestCase):
def test_bad_args(self):
with async_mock.patch.object(
command.ArgumentParser, "print_usage"
) as print_usage:
with self.assertRaises(SystemExit):
command.execute([])
print_usage.assert_called_once()
with self.assertRaises(ArgsParseError):
command.execute([])

with self.assertRaises(SystemExit):
command.execute(["bad"])
Expand All @@ -24,7 +21,20 @@ def test_exec_start(self):
) as run_loop, async_mock.patch.object(
command, "shutdown_app", autospec=True
) as shutdown_app:
command.execute(["-it", "http", "0.0.0.0", "80", "-ot", "http"])
command.execute(
[
"-it",
"http",
"0.0.0.0",
"80",
"-ot",
"http",
"--endpoint",
"0.0.0.0",
"80",
"--no-ledger",
]
)
start_app.assert_called_once()
assert isinstance(start_app.call_args[0][0], command.Conductor)
shutdown_app.assert_called_once()
Expand Down
Loading

0 comments on commit 1f9a3bc

Please sign in to comment.