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

[mod] #89: Use {Revocation,Identity}.__eq__() method

Implemented in DunitePy v1.1
parent 5dac2ae0
No related branches found
No related tags found
1 merge request!170#89: Implement revocation command
......@@ -69,8 +69,7 @@ def check_many_identities(idty: Identity, doc_type: str = "Identity"):
lookup_ids = merge_ids_lists(results_pubkey, results_uid, idty.currency)
match = False
for n, lookup in enumerate(lookup_ids):
# __equal"__ method does not work.
if idty.signed_raw() == lookup.signed_raw():
if idty == lookup:
lookup_ids.pop(n)
match = True
break
......
......@@ -42,29 +42,6 @@ from silkaj.tui import display_pubkey_and_checksum
### useful function ###
def assertEqual(test: Revocation, expected: Revocation):
"""
Checks the equality of two revocation objects.
Should be replaced by 'Revoc1 == Revoc2' once __eq__() method has been published in Duniterpy.
"""
# direct equality fails, I can't find why.
# assert test == expected
# so, let's test all values.
assert test.version == expected.version
assert test.currency == expected.currency
assert test.pubkey == expected.pubkey
# fields for identity
assert test.identity.version == expected.identity.version
assert test.identity.currency == expected.identity.currency
assert test.identity.pubkey == expected.identity.pubkey
assert test.identity.uid == expected.identity.uid
assert test.identity.block_id == expected.identity.block_id
assert test.identity.signature == expected.identity.signature
# test raw and inline are the same
assert test.raw() == expected.raw()
assert test.inline() == expected.inline()
def display_dry_options(display, dry_run):
if display:
return ["--display"]
......@@ -943,7 +920,7 @@ def test_create_revocation_doc(idty, lookup):
currency="g1-test",
identity=idty,
)
assertEqual(test, expected)
assert test == expected
# test save_doc
......@@ -1019,7 +996,7 @@ def test_verify_document(doc, lookup, capsys, monkeypatch):
if len(lookup["results"]) > 1:
assert "One matching identity!\n" in display
assert "Similar identities:" in display
assertEqual(result, doc)
assert result == doc
# test verify_document: no matching identity
......
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