Skip to content
Snippets Groups Projects
Commit e239f0fc authored by Moul's avatar Moul
Browse files

revocation verify: Remove dry-run and display options support (#435)

remove duplicate tests after simplification
parent 63f3b205
No related branches found
No related tags found
1 merge request!248Revocation: remove dry-run and display options from save and verify cmds, drop default revocation file path (#435)
...@@ -106,16 +106,8 @@ existing identity.\nOptionnaly takes the document filename.", ...@@ -106,16 +106,8 @@ existing identity.\nOptionnaly takes the document filename.",
@click.pass_context @click.pass_context
def verify(ctx: click.Context, file: Path) -> None: def verify(ctx: click.Context, file: Path) -> None:
rev_doc = verify_document(file) rev_doc = verify_document(file)
if ctx.obj["DRY_RUN"]:
click.echo(rev_doc.signed_raw())
return
idty_table = idty_tools.display_identity(rev_doc.identity) idty_table = idty_tools.display_identity(rev_doc.identity)
click.echo(idty_table.draw()) click.echo(idty_table.draw())
if ctx.obj["DISPLAY_DOCUMENT"]:
click.echo(rev_doc.signed_raw())
click.echo("Revocation document is valid.") click.echo("Revocation document is valid.")
......
...@@ -143,10 +143,6 @@ def patched_send_bma_revoke_error(wot_useless, rev_doc_useless): ...@@ -143,10 +143,6 @@ def patched_send_bma_revoke_error(wot_useless, rev_doc_useless):
@pytest.mark.parametrize( @pytest.mark.parametrize(
("subcommand", "expected_warn"), ("subcommand", "expected_warn"),
[ [
(
"verify",
False,
),
( (
"publish", "publish",
True, True,
...@@ -265,11 +261,9 @@ def test_revocation_cli_create(file, user_input, expected, monkeypatch): ...@@ -265,11 +261,9 @@ def test_revocation_cli_create(file, user_input, expected, monkeypatch):
# test cli verify # test cli verify
@pytest.mark.parametrize( @pytest.mark.parametrize(
("display", "dry_run", "doc", "lookup", "file", "expected", "not_expected"), ("doc", "lookup", "file", "expected", "not_expected"),
[ [
( (
False,
False,
REV_DOC, REV_DOC,
lookup_one, lookup_one,
"", "",
...@@ -277,11 +271,9 @@ def test_revocation_cli_create(file, user_input, expected, monkeypatch): ...@@ -277,11 +271,9 @@ def test_revocation_cli_create(file, user_input, expected, monkeypatch):
"| Public key |", "| Public key |",
"Revocation document is valid.\n", "Revocation document is valid.\n",
], ],
["Version: 10"], [],
), ),
( (
False,
False,
REV_DOC, REV_DOC,
lookup_two, lookup_two,
"", "",
...@@ -291,50 +283,19 @@ def test_revocation_cli_create(file, user_input, expected, monkeypatch): ...@@ -291,50 +283,19 @@ def test_revocation_cli_create(file, user_input, expected, monkeypatch):
"| Public key |", "| Public key |",
"Revocation document is valid.\n", "Revocation document is valid.\n",
], ],
["Version: 10"],
),
(
True,
False,
REV_DOC,
lookup_one,
"",
[
"Version: 10",
"| Public key |",
"Revocation document is valid.\n",
],
[], [],
), ),
( (
False,
True,
REV_DOC,
lookup_one,
"",
[
"Version: 10",
],
[
"Revocation document is valid.\n",
],
),
(
False,
False,
REV_DOC_FALSE, REV_DOC_FALSE,
lookup_one, lookup_one,
"", "",
["Error: the signature of the revocation document is invalid."], ["Error: the signature of the revocation document is invalid."],
[ [
"Version: 10",
"| Public key |", "| Public key |",
"Revocation document is valid.\n", "Revocation document is valid.\n",
], ],
), ),
( (
False,
False,
REV_2, REV_2,
lookup_two, lookup_two,
"test_doc", "test_doc",
...@@ -347,14 +308,11 @@ def test_revocation_cli_create(file, user_input, expected, monkeypatch): ...@@ -347,14 +308,11 @@ def test_revocation_cli_create(file, user_input, expected, monkeypatch):
[ [
"Revocation document is valid.\n", "Revocation document is valid.\n",
"| Public key |", "| Public key |",
"Version: 10",
], ],
), ),
], ],
) )
def test_revocation_cli_verify( def test_revocation_cli_verify(
display,
dry_run,
doc, doc,
lookup, lookup,
file, file,
...@@ -370,8 +328,7 @@ def test_revocation_cli_verify( ...@@ -370,8 +328,7 @@ def test_revocation_cli_verify(
monkeypatch.setattr(bc_tools, "get_head_block", patched_get_head_block_gtest) monkeypatch.setattr(bc_tools, "get_head_block", patched_get_head_block_gtest)
# prepare command # prepare command
command = display_dry_options(display, dry_run) command = ["wot", "revocation", "verify"]
command.extend(["wot", "revocation", "verify"])
if file: if file:
command.extend([file]) command.extend([file])
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment