Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aca-py startup arg updates #739

Merged
merged 12 commits into from
Oct 7, 2020
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