diff --git a/silkaj/idty_tools.py b/silkaj/idty_tools.py index 7b9b30c44f798411f10836b2e217d8c437264af8..e9a6575bac6ab6f737c7993a90e82801e68b0000 100644 --- a/silkaj/idty_tools.py +++ b/silkaj/idty_tools.py @@ -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 diff --git a/tests/test_revocation.py b/tests/test_revocation.py index afc9fafc306e19b8227a49ec42e86d61cdb8bf56..edabb87ae9aaa467c6347189a0b8b770cb884c52 100644 --- a/tests/test_revocation.py +++ b/tests/test_revocation.py @@ -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