Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
silkaj
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
python
silkaj
Commits
3504d048
Commit
3504d048
authored
3 years ago
by
Moul
Browse files
Options
Downloads
Patches
Plain Diff
[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
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
silkaj/idty_tools.py
+1
-2
1 addition, 2 deletions
silkaj/idty_tools.py
tests/test_revocation.py
+2
-25
2 additions, 25 deletions
tests/test_revocation.py
with
3 additions
and
27 deletions
silkaj/idty_tools.py
+
1
−
2
View file @
3504d048
...
@@ -69,8 +69,7 @@ def check_many_identities(idty: Identity, doc_type: str = "Identity"):
...
@@ -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
)
lookup_ids
=
merge_ids_lists
(
results_pubkey
,
results_uid
,
idty
.
currency
)
match
=
False
match
=
False
for
n
,
lookup
in
enumerate
(
lookup_ids
):
for
n
,
lookup
in
enumerate
(
lookup_ids
):
# __equal"__ method does not work.
if
idty
==
lookup
:
if
idty
.
signed_raw
()
==
lookup
.
signed_raw
():
lookup_ids
.
pop
(
n
)
lookup_ids
.
pop
(
n
)
match
=
True
match
=
True
break
break
...
...
This diff is collapsed.
Click to expand it.
tests/test_revocation.py
+
2
−
25
View file @
3504d048
...
@@ -42,29 +42,6 @@ from silkaj.tui import display_pubkey_and_checksum
...
@@ -42,29 +42,6 @@ from silkaj.tui import display_pubkey_and_checksum
### useful function ###
### 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
):
def
display_dry_options
(
display
,
dry_run
):
if
display
:
if
display
:
return
[
"
--display
"
]
return
[
"
--display
"
]
...
@@ -943,7 +920,7 @@ def test_create_revocation_doc(idty, lookup):
...
@@ -943,7 +920,7 @@ def test_create_revocation_doc(idty, lookup):
currency
=
"
g1-test
"
,
currency
=
"
g1-test
"
,
identity
=
idty
,
identity
=
idty
,
)
)
assert
Equal
(
test
,
expected
)
assert
test
==
expected
# test save_doc
# test save_doc
...
@@ -1019,7 +996,7 @@ def test_verify_document(doc, lookup, capsys, monkeypatch):
...
@@ -1019,7 +996,7 @@ def test_verify_document(doc, lookup, capsys, monkeypatch):
if
len
(
lookup
[
"
results
"
])
>
1
:
if
len
(
lookup
[
"
results
"
])
>
1
:
assert
"
One matching identity!
\n
"
in
display
assert
"
One matching identity!
\n
"
in
display
assert
"
Similar identities:
"
in
display
assert
"
Similar identities:
"
in
display
assert
Equal
(
result
,
doc
)
assert
result
==
doc
# test verify_document: no matching identity
# test verify_document: no matching identity
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment