Skip to content

Commit

Permalink
#6 - Use command genpkey instead of generate.
Browse files Browse the repository at this point in the history
  • Loading branch information
hardbyte committed Jan 8, 2016
1 parent b9fd663 commit c655651
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions phe/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ def cli(verbose=False):
"""CLI for interacting with python-paillier
"""

@cli.command("generate")
@cli.command("genpkey")
@click.argument('output', type=click.File('w'))
@click.option("--keysize", type=int, default=2048,
help="The keysize in bits. Defaults to 2048")
@click.option("--id", type=str, default=None,
help="Add an identifying comment to the key")
def generate_keypair(keysize, id, output):
"""Generate a paillier keypair
"""Generate a paillier keypair.
Output as JWK to given output file. Use "-" to output the private key to
stdout. See the extract command to extract the public component of the
Expand Down
8 changes: 4 additions & 4 deletions phe/tests/cli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_generate_keypair_to_file(self):
runner = CliRunner()

with tempfile.NamedTemporaryFile() as outfile:
result = runner.invoke(cli, ['generate', '--keysize', '256', outfile.name])
result = runner.invoke(cli, ['genpkey', '--keysize', '256', outfile.name])
print(result.output)
assert result.exit_code == 0

Expand All @@ -43,7 +43,7 @@ def test_generate_keypair_to_file(self):
def test_generate_keypair_to_stdout(self):
runner = CliRunner()

result = runner.invoke(cli, ['generate', '--keysize', '256', '-'])
result = runner.invoke(cli, ['genpkey', '--keysize', '256', '-'])

assert 'pub' in result.output
assert 'kty' in result.output
Expand All @@ -53,7 +53,7 @@ def test_extract_public_key(self):
runner = CliRunner()

with tempfile.NamedTemporaryFile() as private_keyfile:
runner.invoke(cli, ['generate', '--keysize', '256', private_keyfile.name])
runner.invoke(cli, ['genpkey', '--keysize', '256', private_keyfile.name])

with tempfile.NamedTemporaryFile() as public_keyfile:
result = runner.invoke(cli, ['extract', private_keyfile.name, public_keyfile.name])
Expand All @@ -80,7 +80,7 @@ def setUpClass(cls):
cls.public_keyfile = tempfile.NamedTemporaryFile()

cls.runner = CliRunner()
cls.runner.invoke(cli, ['generate', '--keysize', '256', cls.private_keyfile.name])
cls.runner.invoke(cli, ['genpkey', '--keysize', '256', cls.private_keyfile.name])
cls.runner.invoke(cli, ['extract', cls.private_keyfile.name, cls.public_keyfile.name])

@classmethod
Expand Down

0 comments on commit c655651

Please sign in to comment.