Skip to content

Commit

Permalink
Update incept args to get the transferable argument to work correctly. (
Browse files Browse the repository at this point in the history
#585)

* Update incept args to get the transferable argument to work correctly.

Signed-off-by: pfeairheller <[email protected]>

* Update test

Signed-off-by: pfeairheller <[email protected]>

* Fix loading args from file for incept.

Signed-off-by: pfeairheller <[email protected]>

---------

Signed-off-by: pfeairheller <[email protected]>
  • Loading branch information
pfeairheller authored Oct 7, 2023
1 parent 7fb492c commit a6684b0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/keri/app/cli/commands/incept.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ def mergeArgsWithFile(args):

incept_opts = config.loadFileOptions(args.file, InceptOptions) if args.file != '' else emptyOptions()

if args.transferable is not None:
incept_opts.transferable = args.transferable
incept_opts.transferable = True if args.transferable else incept_opts.transferable
if len(args.wits) > 0:
incept_opts.wits = args.wits
if args.icount is not None:
Expand Down
2 changes: 1 addition & 1 deletion src/keri/app/cli/common/incepting.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def addInceptingArgs(parser):
"""
Add command line arguments for each of the properties in InceptOptions
"""
parser.add_argument('--transferable', '-tf', type=bool, default=None,
parser.add_argument('--transferable', '-tf', action="store_true",
help='Whether the prefix is transferable or non-transferable')
parser.add_argument('--wits', '-w', default=[], required=False, action="append", metavar="<prefix>",
help='New set of witnesses, replaces all existing witnesses. Can appear multiple times')
Expand Down
8 changes: 4 additions & 4 deletions tests/app/cli/test_kli_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_standalone_kli_commands(helpers, capsys):
directing.runController(doers=doers)

# Create transferable identifier
args = parser.parse_args(["incept", "--name", "test", "--alias", "trans", "--file",
args = parser.parse_args(["incept", "--name", "test", "--alias", "trans", "--transferable", "--file",
os.path.join(TEST_DIR, "transferable-sample.json")])
assert args.handler is not None
doers = args.handler(args)
Expand Down Expand Up @@ -134,7 +134,7 @@ def test_standalone_kli_commands(helpers, capsys):
# Skipping sign and verify, they rely on console output.

# Establishment Only
args = parser.parse_args(["incept", "--name", "test", "--alias", "est-only", "--file",
args = parser.parse_args(["incept", "--name", "test", "--alias", "est-only", "--transferable", "--file",
os.path.join(TEST_DIR, "estonly-sample.json")])
assert args.handler is not None
doers = args.handler(args)
Expand Down Expand Up @@ -267,14 +267,14 @@ def test_incept_and_rotate_opts(helpers, capsys):
with existing.existingHby("test-opts") as hby:
assert os.path.isdir(hby.db.path) is True

args = parser.parse_args(["incept", "--name", "test-opts", "--alias", "trans-args", "--transferable", "True"])
args = parser.parse_args(["incept", "--name", "test-opts", "--alias", "trans-args", "--transferable"])
assert args.handler is not None
# Attempt to incept without required arg isith
with pytest.raises(ValueError):
args.handler(args)

# Incept with command line arguments
args = parser.parse_args(["incept", "--name", "test-opts", "--alias", "trans-args", "--transferable", "True",
args = parser.parse_args(["incept", "--name", "test-opts", "--alias", "trans-args", "--transferable",
"--isith", "1", "--icount", "1", "--nsith", "1", "--ncount", "1", "--toad", "0"])
assert args.handler is not None
doers = args.handler(args)
Expand Down

0 comments on commit a6684b0

Please sign in to comment.