From 547c6b5205845719b7ed6fed7cea65aea62563de Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 6 May 2022 09:30:11 +0200 Subject: [PATCH] Mark signing identities as such in Identity.__repr__ --- earthsnake/identity.py | 3 +++ tests/test_identity.py | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/earthsnake/identity.py b/earthsnake/identity.py index eff8a09..883d893 100644 --- a/earthsnake/identity.py +++ b/earthsnake/identity.py @@ -56,6 +56,9 @@ class Identity: return f'@{self.name}.{base32_bytes_to_string(self.verify_key.to_bytes())}' def __repr__(self) -> str: + if self.sign_key: + return f'' + return f'' def __eq__(self, other: object) -> bool: diff --git a/tests/test_identity.py b/tests/test_identity.py index 712aedc..906d9d0 100644 --- a/tests/test_identity.py +++ b/tests/test_identity.py @@ -67,7 +67,18 @@ def test_str(identity: Identity) -> None: @pytest.mark.id_key_seed(TEST_SEED) @pytest.mark.id_name('test') def test_repr(identity: Identity) -> None: - """Test if the __str__ method returns the author address""" + """Test if the __repr__ method returns the author address""" + + assert ( + repr(identity) + == '' + ) + + +def test_repr_nosign() -> None: + """Test the __repr__ method marks the identity as a signer in the output""" + + identity = Identity.from_address('@test.bcz76z52y5dlpohtkmpuj3jsdcvfmebzpcgfmtmhu4u7hlexzreya') assert ( repr(identity) == ''