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

[mod] #424: flake8: E501 line too long

Cut long lines at ~ 70 chars
parent d9e37d71
No related branches found
No related tags found
1 merge request!212#424: Introduce flake8 pre-commit hook, conf and job
Pipeline #15839 passed
......@@ -43,7 +43,8 @@ from silkaj.wot import id_pubkey_correspondence, received_sent_certifications
@option(
"--endpoint",
"-ep",
help=f"Default endpoint to reach Ğ1 currency by its official node {endpoint(G1_DEFAULT_ENDPOINT).host}\
help=f"Default endpoint to reach Ğ1 currency by its official node\
{endpoint(G1_DEFAULT_ENDPOINT).host}\
This option allows to specify a custom endpoint as follow: <host>:<port>.\
In case no port is specified, it defaults to 443.",
)
......@@ -51,7 +52,8 @@ from silkaj.wot import id_pubkey_correspondence, received_sent_certifications
"--gtest",
"-gt",
is_flag=True,
help=f"Default endpoint to reach ĞTest currency by its official node: {endpoint(G1_TEST_DEFAULT_ENDPOINT).host}",
help=f"Default endpoint to reach ĞTest currency by its official node: \
{endpoint(G1_TEST_DEFAULT_ENDPOINT).host}",
)
@option(
"--auth-scrypt",
......@@ -163,13 +165,15 @@ def about():
\n @@ @@@ @@@@@@@@@@@ @@,\
\n @@ @@@ &@@@@@@@@@@@@@ @@@ Powerfull and lightweight command line client\
\n @@ @@@ @@@@@@@@@# @@@@ @@(\
\n @@ @@@@ @@@@@@@@@ @@@ @@ Built in Python for Duniter’s currencies: Ğ1 and Ğ1-Test\
\n @@ @@@@ @@@@@@@@@ @@@ @@ Built in Python for Duniter’s currencies: \
Ğ1 and Ğ1-Test\
\n @@ @@@ @@@@@@@@ @ @@@ @@\
\n @@ @@@ @@@@@@ @@@@ @@ @@ Authors: see AUTHORS.md file\
\n @@ @@@@ @@@ @@@@@@@ @@ @@\
\n @@ @@@@* @@@@@@@@@ @# @@ Website: https://silkaj.duniter.org\
\n @@ @@@@@ @@@@@@@@@@ @ ,@@\
\n @@ @@@@@ @@@@@@@@@@ @ ,@@ Repository: https://git.duniter.org/clients/python/silkaj\
\n @@ @@@@@ @@@@@@@@@@ @ ,@@ Repository: \
https://git.duniter.org/clients/python/silkaj\
\n @@@ @@@@@@@@@@@@ @ @@*\
\n @@@ @@@@@@@@ @ @@@ License: GNU AGPLv3\
\n @@@@ @@ @@@,\
......
......@@ -111,7 +111,8 @@ def display_diffi(current, diffi):
match = match_pattern(int(current["powMin"]))[0]
table = tabulate(sorted_diffi, headers="keys", tablefmt="orgtbl", stralign="center")
content = f'Current block: n°{current["number"]}, generated on {block_gen}\n\
Generation of next block n°{diffi["block"]} possible by at least {issuers}/{len(diffi["levels"])} members\n\
Generation of next block n°{diffi["block"]} \
possible by at least {issuers}/{len(diffi["levels"])} members\n\
Common Proof-of-Work difficulty level: {current["powMin"]}, hash starting with `{match}`\n{table}'
print(content)
......
......@@ -64,7 +64,8 @@ def check_many_identities(document: Union[Identity, Revocation]):
results_uid = wt.wot_lookup(idty.uid)
except urllib.error.HTTPError:
sys.exit(
f"{error_no_identical_id}\nuid: {idty.uid}\npubkey: {display_pubkey_and_checksum(idty.pubkey)}"
f"{error_no_identical_id}\nuid: {idty.uid}\npubkey: \
{display_pubkey_and_checksum(idty.pubkey)}"
)
# get all matching identities
......
......@@ -35,7 +35,8 @@ def determine_endpoint():
"""
regex = f"^(?:(?P<host>{du_const.HOST_REGEX})|(?P<ipv4>{du_const.IPV4_REGEX})|\
(?:\\[(?P<ipv6>{du_const.IPV6_REGEX})\\]))(?::(?P<port>{du_const.PORT_REGEX}))?(?:/(?P<path>{du_const.PATH_REGEX}))?$"
(?:\\[(?P<ipv6>{du_const.IPV6_REGEX})\\]))(?::(?P<port>{du_const.PORT_REGEX}))?\
(?:/(?P<path>{du_const.PATH_REGEX}))?$"
try:
from click.globals import get_current_context
......
......@@ -189,7 +189,8 @@ def save_doc(path: str, content: str, pubkey: str):
# Ask confirmation if the file exists
if rev_path.is_file():
if click.confirm(
f"Would you like to erase existing file `{path}` with the generated revocation document corresponding to {pubkey_cksum} public key?"
f"Would you like to erase existing file `{path}` with the \
generated revocation document corresponding to {pubkey_cksum} public key?"
):
rev_path.unlink()
else:
......
......@@ -41,7 +41,9 @@ from silkaj.constants import (
MAX_COMMENT_LENGTH = 255
# max size for tx doc is 100 lines. Formula for accepted field numbers is : (2 * IU + 2 * IS + OUT) <= ( MAX_LINES_IN_TX_DOC - FIX_LINES)
# max size for tx doc is 100 lines.
# Formula for accepted field numbers is:
# (2 * IU + 2 * IS + OUT) <= ( MAX_LINES_IN_TX_DOC - FIX_LINES)
# with IU = inputs/unlocks ; IS = Issuers/Signatures ; OUT = Outpouts.
MAX_LINES_IN_TX_DOC = 100
# 2 lines are necessary, and we block 1 more for the comment
......@@ -98,7 +100,8 @@ Sending to many recipients is possible:\n\
"file_path",
"--file",
"-f",
help="File’s path containing a list of amounts in absolute or relative reference and recipients’ pubkeys",
help="File’s path containing a list of amounts in absolute or \
relative reference and recipients’ pubkeys",
cls=cli_tools.MutuallyExclusiveOption,
mutually_exclusive=["recipients", "amounts", "amountsUD", "allsources"],
)
......@@ -142,7 +145,8 @@ def send_transaction(
if allsources:
if pubkey_amount[0] <= 0:
tools.message_exit(
f"Error: Issuer pubkey {tui.display_pubkey_and_checksum(issuer_pubkey)} is empty. No transaction sent."
f"Error: Issuer pubkey {tui.display_pubkey_and_checksum(issuer_pubkey)} is empty. \
No transaction sent."
)
tx_amounts = [pubkey_amount[0]]
......@@ -495,7 +499,8 @@ def generate_transaction_document(
if not OutputbackChange:
OutputbackChange = issuers
# if it's not a foreign exchange transaction, we remove units after 2 digits after the decimal point.
# If it's not a foreign exchange transaction,
# we remove units after two digits after the decimal point
if issuers not in outputAddresses:
total_tx_amount = (
total_tx_amount // 10**curentUnitBase
......@@ -556,7 +561,8 @@ def checkComment(comment):
if len(comment) > MAX_COMMENT_LENGTH:
tools.message_exit("Error: Comment is too long")
regex = compile(
"^[0-9a-zA-Z\\ \\-\\_\\:\\/\\;\\*\\[\\]\\(\\)\\?\\!\\^\\+\\=\\@\\&\\~\\#\\{\\}\\|\\\\<\\>\\%\\.]*$"
"^[0-9a-zA-Z\\ \\-\\_\\:\\/\\;\\*\\[\\]\\(\\)\\?\
\\!\\^\\+\\=\\@\\&\\~\\#\\{\\}\\|\\\\<\\>\\%\\.]*$"
)
if not search(regex, comment):
tools.message_exit("Error: the format of the comment is invalid")
......
......@@ -45,7 +45,8 @@ def get_sent_certifications(signed, time_first_block, params):
@click.command(
"wot",
help="Check received and sent certifications and consult the membership status of any given identity",
help="Check received and sent certifications and \
consult the membership status of any given identity",
)
@click.argument("uid_pubkey")
def received_sent_certifications(uid_pubkey):
......@@ -90,7 +91,8 @@ def received_sent_certifications(uid_pubkey):
)
txt = f'{identity["uid"]} ({display_pubkey_and_checksum(pubkey, True)}) \
from block #{identity["meta"]["timestamp"][:15]}\n\
received {len(certifications["received"])} and sent {nbr_sent_certs}/{params["sigStock"]} certifications:\n\
received {len(certifications["received"])} and \
sent {nbr_sent_certs}/{params["sigStock"]} certifications:\n\
{table}\n\
✔: Certification available to be written or already written into the blockchain\n'
print(txt)
......
......@@ -24,7 +24,8 @@ idty1 = Identity(
"597334-002A45E751DCA7535D4F0A082F493E2C8EFF07612683525EB5DA92B6D17C30BD"
),
)
idty1.signature = "kFW2we2K3zx4PZODx0Wf+xdXAJTmYD+yqdyZBsPF7UwqdaCA4N+yHj7+09Gjsttl0i9GtWzodyJ6mBE1q7jcAw=="
idty1.signature = "kFW2we2K3zx4PZODx0Wf+xdXAJTmYD+yqdyZBsPF7UwqdaCA4N\
+yHj7+09Gjsttl0i9GtWzodyJ6mBE1q7jcAw=="
lookup_one = {
"partial": False,
......@@ -35,12 +36,14 @@ lookup_one = {
{
"uid": "Claude",
"meta": {
"timestamp": "597334-002A45E751DCA7535D4F0A082F493E2C8EFF07612683525EB5DA92B6D17C30BD"
"timestamp": "597334-002A45E751DCA7535D4F0A08\
2F493E2C8EFF07612683525EB5DA92B6D17C30BD"
},
"revoked": False,
"revoked_on": None,
"revocation_sig": None,
"self": "kFW2we2K3zx4PZODx0Wf+xdXAJTmYD+yqdyZBsPF7UwqdaCA4N+yHj7+09Gjsttl0i9GtWzodyJ6mBE1q7jcAw==",
"self": "kFW2we2K3zx4PZODx0Wf+xdXAJTmYD+yqdyZBsPF\
7UwqdaCA4N+yHj7+09Gjsttl0i9GtWzodyJ6mBE1q7jcAw==",
"others": [],
},
],
......@@ -58,23 +61,27 @@ lookup_two = {
{
"uid": "Claude",
"meta": {
"timestamp": "597334-002A45E751DCA7535D4F0A082F493E2C8EFF07612683525EB5DA92B6D17C30BD"
"timestamp": "597334-002A45E751DCA7535D4F0A08\
2F493E2C8EFF07612683525EB5DA92B6D17C30BD"
},
"revoked": False,
"revoked_on": None,
"revocation_sig": None,
"self": "kFW2we2K3zx4PZODx0Wf+xdXAJTmYD+yqdyZBsPF7UwqdaCA4N+yHj7+09Gjsttl0i9GtWzodyJ6mBE1q7jcAw==",
"self": "kFW2we2K3zx4PZODx0Wf+xdXAJTmYD+yqdyZBsPF\
7UwqdaCA4N+yHj7+09Gjsttl0i9GtWzodyJ6mBE1q7jcAw==",
"others": [],
},
{
"uid": "Claudia",
"meta": {
"timestamp": "597334-002A45E751DCA7535D4F0A082F493E2C8EFF07612683525EB5DA92B6D17C30BD"
"timestamp": "597334-002A45E751DCA7535D4F0A08\
2F493E2C8EFF07612683525EB5DA92B6D17C30BD"
},
"revoked": False,
"revoked_on": None,
"revocation_sig": None,
"self": "kFW2we2K3zx4PZODx0Wf+xdXAJTmYD+yqdyZBsPF7UwqdaCA4N+yHj7+09Gjsttl0i9GtWzodyJ6mBE1q7jcAw==",
"self": "kFW2we2K3zx4PZODx0Wf+xdXAJTmYD+yqdyZBsPF\
7UwqdaCA4N+yHj7+09Gjsttl0i9GtWzodyJ6mBE1q7jcAw==",
"others": [],
},
],
......@@ -92,12 +99,14 @@ lookup_three = {
{
"uid": "Claude",
"meta": {
"timestamp": "597334-002A45E751DCA7535D4F0A082F493E2C8EFF07612683525EB5DA92B6D17C30BD"
"timestamp": "597334-002A45E751DCA7535D4F0A08\
2F493E2C8EFF07612683525EB5DA92B6D17C30BD"
},
"revoked": False,
"revoked_on": None,
"revocation_sig": None,
"self": "kFW2we2K3zx4PZODx0Wf+xdXAJTmYD+yqdyZBsPF7UwqdaCA4N+yHj7+09Gjsttl0i9GtWzodyJ6mBE1q7jcAw==",
"self": "kFW2we2K3zx4PZODx0Wf+xdXAJTmYD+yqdyZBsPF\
7UwqdaCA4N+yHj7+09Gjsttl0i9GtWzodyJ6mBE1q7jcAw==",
"others": [],
},
],
......@@ -108,12 +117,14 @@ lookup_three = {
{
"uid": "Claude",
"meta": {
"timestamp": "597334-002A45E751DCA7535D4F0A082F493E2C8EFF07612683525EB5DA92B6D17C30BD"
"timestamp": "597334-002A45E751DCA7535D4F0A08\
2F493E2C8EFF07612683525EB5DA92B6D17C30BD"
},
"revoked": False,
"revoked_on": None,
"revocation_sig": None,
"self": "kFW2we2K3zx4PZODx0Wf+xdXAJTmYD+yqdyZBsPF7UwqdaCA4N+yHj7+09Gjsttl0i9GtWzodyJ6mBE1q7jcAw==",
"self": "kFW2we2K3zx4PZODx0Wf+xdXAJTmYD+yqdyZBsPF\
7UwqdaCA4N+yHj7+09Gjsttl0i9GtWzodyJ6mBE1q7jcAw==",
"others": [],
},
],
......@@ -130,7 +141,8 @@ idty2 = Identity(
"703902-00002D6BC5E4FC540A4E188C3880A0ACCA06CD77017D26231A515312162B4070"
),
)
idty2.signature = "3RNQcKNI1VMmuCpK7wer8haOA959EQSDIR1v0Ue/7TpTCOmsU2zYCpC+tqgLQFxDX4A79sB61c11J5C/3Z/TCw=="
idty2.signature = "3RNQcKNI1VMmuCpK7wer8haOA959EQSDIR1v0Ue/7TpTCOmsU2\
zYCpC+tqgLQFxDX4A79sB61c11J5C/3Z/TCw=="
idty_block = {
......@@ -148,7 +160,8 @@ idty_block = {
"issuersFrameVar": 0,
"currency": "g1-test",
"issuer": "3dnbnYY9i2bHMQUGyFp5GVvJ2wBkVpus31cDJA5cfRpj",
"signature": "Eme9mi25DtUQrP3Hk6evJBQP6GRU0asJrl9G2RWUgtB71AMOWqs/NeraG8YBwQEGokQg1mHMUv7fEoUiEetwDw==",
"signature": "Eme9mi25DtUQrP3Hk6evJBQP6GRU0asJrl9G2RWUgtB71AMOWqs\
/NeraG8YBwQEGokQg1mHMUv7fEoUiEetwDw==",
"hash": "002A45E751DCA7535D4F0A082F493E2C8EFF07612683525EB5DA92B6D17C30BD",
"parameters": "",
"previousHash": "0023B87885C52CDE75694C71BED1237B5C7B686C00AB68C8D75693513E1F8765",
......@@ -163,5 +176,13 @@ idty_block = {
"excluded": [],
"certifications": [],
"transactions": [],
"raw": "Version: 12\nType: Block\nCurrency: g1-test\nNumber: 597334\nPoWMin: 45\nTime: 1594980185\nMedianTime: 1594978717\nUnitBase: 3\nIssuer: 3dnbnYY9i2bHMQUGyFp5GVvJ2wBkVpus31cDJA5cfRpj\nIssuersFrame: 16\nIssuersFrameVar: 0\nDifferentIssuersCount: 3\nPreviousHash: 0023B87885C52CDE75694C71BED1237B5C7B686C00AB68C8D75693513E1F8765\nPreviousIssuer: 39YyHCMQNmXY7NkPCXXfzpV1vYct4GBxwgfyd4d72HmB\nMembersCount: 7\nIdentities:\nJoiners:\nActives:\nLeavers:\nRevoked:\nExcluded:\nCertifications:\nTransactions:\nInnerHash: 46D99F8431053892F230E4E07EC16A2A68B09D68EBC3F9FD796289493AFAFFB5\nNonce: 10100000000525\n",
"raw": "Version: 12\nType: Block\nCurrency: g1-test\nNumber: 597334\n\
PoWMin: 45\nTime: 1594980185\nMedianTime: 1594978717\nUnitBase: 3\n\
Issuer: 3dnbnYY9i2bHMQUGyFp5GVvJ2wBkVpus31cDJA5cfRpj\nIssuersFrame: 16\n\
IssuersFrameVar: 0\nDifferentIssuersCount: 3\n\
PreviousHash: 0023B87885C52CDE75694C71BED1237B5C7B686C00AB68C8D75693513E1F8765\n\
PreviousIssuer: 39YyHCMQNmXY7NkPCXXfzpV1vYct4GBxwgfyd4d72HmB\nMembersCount: 7\n\
Identities:\nJoiners:\nActives:\nLeavers:\nRevoked:\nExcluded:\nCertifications:\n\
Transactions:\nInnerHash: 46D99F8431053892F230E4E07EC16A2A68B09D68EBC3F9FD796289493AFAFFB5\n\
Nonce: 10100000000525\n",
}
......@@ -33,7 +33,8 @@ fake_received_tx_hist = [
],
"unlocks": ["0:SIG(0)"],
"signatures": [
"xz/l3o9GbUclrYDNKiRaVTrBP7cppDmrjDgE2rFNLJsnpu1e/AE2bHylftU09NYEDqzCUbehv19oF6zIRVwTDw=="
"xz/l3o9GbUclrYDNKiRaVTrBP7cppDmrjDgE2rFNLJsnpu1e/AE2bHyl\
ftU09NYEDqzCUbehv19oF6zIRVwTDw=="
],
"comment": "initialisation",
"hash": "D2271075F2308C4092B1F57B3F1BE12AB684FAFCA62BA8EFE9F7F4D7A4D8D69F",
......@@ -54,7 +55,8 @@ fake_received_tx_hist = [
],
"unlocks": ["0:SIG(0)"],
"signatures": [
"pYSOTCrl1QbsKrgjgNWnUfD3wJnpbalv9EwjAbZozTbTOSzYoj+UInzKS8/OiSdyVqFVDLdpewTD+FOHRENDAA=="
"pYSOTCrl1QbsKrgjgNWnUfD3wJnpbalv9EwjAbZozTbTOSzYoj+UInzK\
S8/OiSdyVqFVDLdpewTD+FOHRENDAA=="
],
"comment": "",
"hash": "F1F2E6D6CF123AB78B98B662FE3AFDD2577B8F6CEBC245660B2E67BC9C2026F6",
......@@ -78,7 +80,8 @@ fake_sent_tx_hist = [
"outputs": ["100:0:SIG(CvrMiUhAJpNyX5sdAyZqPE6yEFfSsf6j9EpMmeKvMCWW)"],
"unlocks": ["0:SIG(0)"],
"signatures": [
"cMNp7FF5yT/6LJT9CnNzkE08h+APEAYYwdFIROGxUZ9JGqbfPR1NRbcruq5Fl9BnBcJkuMNJbOwuYV8bPCmICw=="
"cMNp7FF5yT/6LJT9CnNzkE08h+APEAYYwdFIROGxUZ9JGqbfPR1NRbcr\
uq5Fl9BnBcJkuMNJbOwuYV8bPCmICw=="
],
"comment": "",
"hash": "580715ECD6743590F7A99A6C97E63511BC94B0293CB0037C6A3C96482F8DC7D2",
......@@ -98,7 +101,8 @@ fake_sent_tx_hist = [
"outputs": ["100:0:SIG(CmFKubyqbmJWbhyH2eEPVSSs4H4NeXGDfrETzEnRFtPd)"],
"unlocks": ["0:SIG(0)"],
"signatures": [
"WL3dRX4XUenWlDYYhRmEOUgL5+Tc08LlOJWHNjmTlxqtsdHhGn7MuQ3lK+3Xv7PV6VFEEdc3vlJ52pWCLKN5BA=="
"WL3dRX4XUenWlDYYhRmEOUgL5+Tc08LlOJWHNjmTlxqtsdHhGn7MuQ3l\
K+3Xv7PV6VFEEdc3vlJ52pWCLKN5BA=="
],
"comment": "",
"hash": "E874CDAC01D9F291DC1E03F8B0ADB6C19259DE5A11FB73A16318BA1AD59B9EDC",
......
......@@ -37,7 +37,8 @@ def test_gen_checksum(pubkey, checksum):
(
"J4c8CARmP9vAFNGtHRuzx14zvxojyRWHW2darguVqjtX",
"KA",
"Error: public key 'J4c8CARmP9vAFNGtHRuzx14zvxojyRWHW2darguVqjtX' does not match checksum 'KA'.\nPlease verify the public key.\n",
"Error: public key 'J4c8CARmP9vAFNGtHRuzx14zvxojyRWHW2darguVqjtX' \
does not match checksum 'KA'.\nPlease verify the public key.\n",
),
],
)
......@@ -97,11 +98,13 @@ def test_is_pubkey_and_check(uid_pubkey, expected):
[
(
"J4c8CARmP9vAFNGtHRuzx14zvxojyRWHW2darguVqjtX:KA",
"Error: bad format for following public key: J4c8CARmP9vAFNGtHRuzx14zvxojyRWHW2darguVqjtX:KA",
"Error: bad format for following public key: \
J4c8CARmP9vAFNGtHRuzx14zvxojyRWHW2darguVqjtX:KA",
),
(
"J4c8CARmP9vAFNGtHRuzx14zvxojyRWHW2darguVqjtX:KAt",
"Error: Wrong checksum for following public key: J4c8CARmP9vAFNGtHRuzx14zvxojyRWHW2darguVqjtX",
"Error: Wrong checksum for following public key: \
J4c8CARmP9vAFNGtHRuzx14zvxojyRWHW2darguVqjtX",
),
],
)
......
......@@ -44,7 +44,8 @@ id_moul_test_1 = Identity(
"167750-0000A51FF952B76AAA594A46CA0C8156A56988D2B2B57BE18ECB4F3CFC25CEC2"
),
)
id_moul_test_1.signature = "/15YBc4JDPvKD4c8nWD6C0XN0krrS32uDRSH6rJvMFih/H5nPc8oiCgL27bA7P3NPnp+oCqbS12QygQRnhoDDQ=="
id_moul_test_1.signature = "/15YBc4JDPvKD4c8nWD6C0XN0krrS32uDRSH6rJvM\
Fih/H5nPc8oiCgL27bA7P3NPnp+oCqbS12QygQRnhoDDQ=="
id_elois_test = Identity(
currency="g1-test",
......@@ -54,7 +55,8 @@ id_elois_test = Identity(
"0-E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855"
),
)
id_elois_test.signature = "HFmZy01XSXSSsqRWYKR+nIsaReBruJUqYHqJh3EtdRkHV3i30S2lM32pM2w4GHYXNIiOf4+NXzcmuEQVkewBAA=="
id_elois_test.signature = "HFmZy01XSXSSsqRWYKR+nIsaReBruJUqYHqJh3EtdR\
kHV3i30S2lM32pM2w4GHYXNIiOf4+NXzcmuEQVkewBAA=="
id_moul_test_3 = Identity(
version=10,
......@@ -65,7 +67,8 @@ id_moul_test_3 = Identity(
"287573-00003674E9A2B5127327542CFA36BCB95D05E8EBD8AAF9C684B19EB7502161D4"
),
)
id_moul_test_3.signature = "BB1Ete898yN/ZwQn4H7o0gsS1JD05zZBSd7qdU2AmSSZLtjG199fN0Z5jKjQi7S2IVvrH0G5cft74sufVS3+Cw=="
id_moul_test_3.signature = "BB1Ete898yN/ZwQn4H7o0gsS1JD05zZBSd7qdU2Am\
SSZLtjG199fN0Z5jKjQi7S2IVvrH0G5cft74sufVS3+Cw=="
# idty lists for following tests
ids_list_for_merge_lists = [
......@@ -132,12 +135,14 @@ def test_display_alternate_ids():
{
"uid": "moul-test",
"meta": {
"timestamp": "167750-0000A51FF952B76AAA594A46CA0C8156A56988D2B2B57BE18ECB4F3CFC25CEC2"
"timestamp": "167750-0000A51FF952B76A\
AA594A46CA0C8156A56988D2B2B57BE18ECB4F3CFC25CEC2"
},
"revoked": False,
"revoked_on": None,
"revocation_sig": None,
"self": "/15YBc4JDPvKD4c8nWD6C0XN0krrS32uDRSH6rJvMFih/H5nPc8oiCgL27bA7P3NPnp+oCqbS12QygQRnhoDDQ==",
"self": "/15YBc4JDPvKD4c8nWD6C0XN0krrS32u\
DRSH6rJvMFih/H5nPc8oiCgL27bA7P3NPnp+oCqbS12QygQRnhoDDQ==",
"others": [],
}
],
......@@ -149,12 +154,14 @@ def test_display_alternate_ids():
{
"uid": "elois",
"meta": {
"timestamp": "0-E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855"
"timestamp": "0-E3B0C44298FC1C149AFBF\
4C8996FB92427AE41E4649B934CA495991B7852B855"
},
"revoked": True,
"revoked_on": 1540589179,
"revocation_sig": None,
"self": "HFmZy01XSXSSsqRWYKR+nIsaReBruJUqYHqJh3EtdRkHV3i30S2lM32pM2w4GHYXNIiOf4+NXzcmuEQVkewBAA==",
"self": "HFmZy01XSXSSsqRWYKR+nIsaReBruJUq\
YHqJh3EtdRkHV3i30S2lM32pM2w4GHYXNIiOf4+NXzcmuEQVkewBAA==",
"others": [],
}
],
......@@ -168,12 +175,14 @@ def test_display_alternate_ids():
{
"uid": "moul-test",
"meta": {
"timestamp": "167750-0000A51FF952B76AAA594A46CA0C8156A56988D2B2B57BE18ECB4F3CFC25CEC2"
"timestamp": "167750-0000A51FF952B76A\
AA594A46CA0C8156A56988D2B2B57BE18ECB4F3CFC25CEC2"
},
"revoked": False,
"revoked_on": None,
"revocation_sig": None,
"self": "/15YBc4JDPvKD4c8nWD6C0XN0krrS32uDRSH6rJvMFih/H5nPc8oiCgL27bA7P3NPnp+oCqbS12QygQRnhoDDQ==",
"self": "/15YBc4JDPvKD4c8nWD6C0XN0krrS32u\
DRSH6rJvMFih/H5nPc8oiCgL27bA7P3NPnp+oCqbS12QygQRnhoDDQ==",
"others": [],
}
],
......@@ -185,12 +194,15 @@ def test_display_alternate_ids():
{
"uid": "moul-test",
"meta": {
"timestamp": "287573-00003674E9A2B5127327542CFA36BCB95D05E8EBD8AAF9C684B19EB7502161D4"
"timestamp": "287573-00003674E9A2B512\
7327542CFA36BCB95D05E8EBD8AAF9C684B19EB7502161D4"
},
"revoked": True,
"revoked_on": 1544923049,
"revocation_sig": "oRBunChfKUUMqZLCB+0QO8LpQcpx9FZJNXIt79Q/zRPpi9X1hNUPKV4myMxHBSVI6YbPB+gBw/Bb+n3kaIuRAg==",
"self": "BB1Ete898yN/ZwQn4H7o0gsS1JD05zZBSd7qdU2AmSSZLtjG199fN0Z5jKjQi7S2IVvrH0G5cft74sufVS3+Cw==",
"revocation_sig": "oRBunChfKUUMqZLCB+0QO8\
LpQcpx9FZJNXIt79Q/zRPpi9X1hNUPKV4myMxHBSVI6YbPB+gBw/Bb+n3kaIuRAg==",
"self": "BB1Ete898yN/ZwQn4H7o0gsS1JD05zZB\
Sd7qdU2AmSSZLtjG199fN0Z5jKjQi7S2IVvrH0G5cft74sufVS3+Cw==",
"others": [],
}
],
......@@ -220,12 +232,14 @@ def test_merge_ids_lists(lookups_pubkey, lookups_uid, currency, expected):
{
"uid": "moul-test",
"meta": {
"timestamp": "167750-0000A51FF952B76AAA594A46CA0C8156A56988D2B2B57BE18ECB4F3CFC25CEC2"
"timestamp": "167750-0000A51FF952B76A\
AA594A46CA0C8156A56988D2B2B57BE18ECB4F3CFC25CEC2"
},
"revoked": False,
"revoked_on": None,
"revocation_sig": None,
"self": "/15YBc4JDPvKD4c8nWD6C0XN0krrS32uDRSH6rJvMFih/H5nPc8oiCgL27bA7P3NPnp+oCqbS12QygQRnhoDDQ==",
"self": "/15YBc4JDPvKD4c8nWD6C0XN0krrS32u\
DRSH6rJvMFih/H5nPc8oiCgL27bA7P3NPnp+oCqbS12QygQRnhoDDQ==",
"others": [],
}
],
......@@ -237,12 +251,14 @@ def test_merge_ids_lists(lookups_pubkey, lookups_uid, currency, expected):
{
"uid": "elois",
"meta": {
"timestamp": "0-E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855"
"timestamp": "0-E3B0C44298FC1C149AFBF\
4C8996FB92427AE41E4649B934CA495991B7852B855"
},
"revoked": True,
"revoked_on": 1540589179,
"revocation_sig": None,
"self": "HFmZy01XSXSSsqRWYKR+nIsaReBruJUqYHqJh3EtdRkHV3i30S2lM32pM2w4GHYXNIiOf4+NXzcmuEQVkewBAA==",
"self": "HFmZy01XSXSSsqRWYKR+nIsaReBruJUq\
YHqJh3EtdRkHV3i30S2lM32pM2w4GHYXNIiOf4+NXzcmuEQVkewBAA==",
"others": [],
}
],
......@@ -345,7 +361,8 @@ def test_display_identity(idty, monkeypatch, capsys):
None,
None,
[
f"Identity document does not match any valid identity.\nuid: {idty1.uid}\npubkey: {display_pubkey_and_checksum(idty1.pubkey)}"
f"Identity document does not match any valid identity.\n\
uid: {idty1.uid}\npubkey: {display_pubkey_and_checksum(idty1.pubkey)}"
],
False,
),
......@@ -378,7 +395,8 @@ def test_check_many_identities(
# identity does not exist
if expected == [
f"Identity document does not match any valid identity.\nuid: {idty.uid}\npubkey: {display_pubkey_and_checksum(idty.pubkey)}"
f"Identity document does not match any valid identity.\
\nuid: {idty.uid}\npubkey: {display_pubkey_and_checksum(idty.pubkey)}"
]:
with pytest.raises(SystemExit) as pytest_exit:
result = idty_tools.check_many_identities(idty)
......
......@@ -53,7 +53,8 @@ def test_get_sources(monkeypatch):
"identifier": "0D6A29451E64F468C0DB19F70D0D17F65BDCC98F3A16DD55B3755BE124B3DD6C",
"amount": 30,
"base": 3,
"conditions": "(SIG(2VgEZnrGQ5hEgwoNrcXZnD9c8o5jL63LPBmJdvMyFhGe) || (SIG(AhRMHUxMPXSeG7qXZrE6qCdjwK9p2bu5Eqei7xAWVEDK) && CSV(864)))",
"conditions": "(SIG(2VgEZnrGQ5hEgwoNrcXZnD9c8o5jL63LPBmJdvMyFhGe)\
|| (SIG(AhRMHUxMPXSeG7qXZrE6qCdjwK9p2bu5Eqei7xAWVEDK) && CSV(864)))",
},
],
}
......@@ -71,7 +72,8 @@ def test_get_sources(monkeypatch):
{
"version": 10,
"locktime": 0,
"blockstamp": "671977-000008B6DE75715D3D83450A957CD75F781DA8E3E8E966D42A02F59049209533",
"blockstamp": "671977-000008B6DE75715D3D83450\
A957CD75F781DA8E3E8E966D42A02F59049209533",
"blockstampTime": 1607363853,
"issuers": ["6upqFiJ66WV6N3bPc8x8y7rXT3syqKRmwnVyunCtEj7o"],
"inputs": [
......@@ -83,7 +85,8 @@ def test_get_sources(monkeypatch):
],
"unlocks": ["0:SIG(0)"],
"signatures": [
"lrmzr/RkecJBOczlmkp3BNCiXejBzTnHdqmNzxQJyJDIx0UHON4jYkqVKeD77+nrOl8jVtonLt3ZYqd1fhi1Cw=="
"lrmzr/RkecJBOczlmkp3BNCiXejBzTnHdqmNzxQJ\
yJDIx0UHON4jYkqVKeD77+nrOl8jVtonLt3ZYqd1fhi1Cw=="
],
"comment": "DEMAIN DES L_AUBE",
"hash": "D5A1A1AAA43FAA242CC2B19763619DA625092BB7FD23397AD362215375A920C8",
......
......@@ -53,14 +53,16 @@ REV_DOC = Revocation(
currency="g1-test",
identity=idty1,
)
REV_DOC.signature = "dTv6HHnyBsMXofOZFT21Y3gRzG/frseCaZFfpatpCWjYsNA8HPHjTibLUcJ3E9ZUgd0QUV7Bbu868xQE+j/yAg=="
REV_DOC.signature = "dTv6HHnyBsMXofOZFT21Y3gRzG/frseCaZFfpatpCWj\
YsNA8HPHjTibLUcJ3E9ZUgd0QUV7Bbu868xQE+j/yAg=="
REV_DOC_FALSE = Revocation(
version=10,
currency="g1-test",
identity=idty1,
)
REV_DOC_FALSE.signature = "XXXXXXXXBsMXofOZFT21Y3gRzG/frseCaZFfpatpCWjYsNA8HPHjTibLUcJ3E9ZUgd0QUV7Bbu868xQE+j/yAg=="
REV_DOC_FALSE.signature = "XXXXXXXXBsMXofOZFT21Y3gRzG/frseCaZFfp\
atpCWjYsNA8HPHjTibLUcJ3E9ZUgd0QUV7Bbu868xQE+j/yAg=="
# idty2
......@@ -70,14 +72,16 @@ REV_2 = Revocation(
currency="g1-test",
identity=idty2,
)
REV_2.signature = "42D2vbIJnv2aGqUMbD+BF+eChzzGo4R3CVPAl5hpIGvoTcZQCfKBsRRlZDx6Gwn6lsJ3KLiIwPQeJKGYCW2YBg=="
REV_2.signature = "42D2vbIJnv2aGqUMbD+BF+eChzzGo4R3CVPAl5hpIGvoT\
cZQCfKBsRRlZDx6Gwn6lsJ3KLiIwPQeJKGYCW2YBg=="
REV_2_FALSE = Revocation(
version=10,
currency="g1-test",
identity=idty2,
)
REV_2_FALSE.signature = "XXXXXXIJnv2aGqUMbD+BF+eChzzGo4R3CVPAl5hpIGvoTcZQCfKBsRRlZDx6Gwn6lsJ3KLiIwPQeJKGYCW2YBg=="
REV_2_FALSE.signature = "XXXXXXIJnv2aGqUMbD+BF+eChzzGo4R3CVPAl5hp\
IGvoTcZQCfKBsRRlZDx6Gwn6lsJ3KLiIwPQeJKGYCW2YBg=="
WRONG_FORMAT_REV = "ersion: 10\
......@@ -86,7 +90,8 @@ Currency: g1-test\
Issuer: 969qRJs8KhsnkyzqarpL4RKZGMdVKNbZgu8fhsigM7Lj\
IdtyUniqueID: aa_aa\
IdtyTimestamp: 703902-00002D6BC5E4FC540A4E188C3880A0ACCA06CD77017D26231A515312162B4070\
IdtySignature: 3RNQcKNI1VMmuCpK7wer8haOA959EQSDIR1v0Ue/7TpTCOmsU2zYCpC+tqgLQFxDX4A79sB61c11J5C/3Z/TCw==\
IdtySignature: 3RNQcKNI1VMmuCpK7wer8haOA959EQSDIR1v0U\
e/7TpTCOmsU2zYCpC+tqgLQFxDX4A79sB61c11J5C/3Z/TCw==\
42D2vbIJnv2aGqUMbD+BF+eChzzGo4R3CVPAl5hpIGvoTcZQCfKBsRRlZDx6Gwn6lsJ3KLiIwPQeJKGYCW2YBg=="
......@@ -112,7 +117,8 @@ def patched_choose_identity(pubkey):
{
"uid": idty1.uid,
"meta": {"timestamp": str(idty1.block_id)},
"self": "kFW2we2K3zx4PZODx0Wf+xdXAJTmYD+yqdyZBsPF7UwqdaCA4N+yHj7+09Gjsttl0i9GtWzodyJ6mBE1q7jcAw==",
"self": "kFW2we2K3zx4PZODx0Wf+xdXAJTmYD+yqdyZBsPF7UwqdaCA4N+yHj7+09\
Gjsttl0i9GtWzodyJ6mBE1q7jcAw==",
},
idty1.pubkey,
None,
......@@ -959,7 +965,8 @@ def test_save_doc(path, rev_1, rev_2, pubkey, capsys, monkeypatch):
# test file is overwritten if confirm
monkeypatch.setattr(click, "confirm", value=conf_true)
revocation.save_doc(path, rev_2.signed_raw(), pubkey)
expected_confirm = f"Revocation document file stored into `{path}` for following public key: {display_pubkey_and_checksum(pubkey)}"
expected_confirm = f"Revocation document file stored into `{path}` \
for following public key: {display_pubkey_and_checksum(pubkey)}"
assert expected_confirm in capsys.readouterr().out
with open(path) as f:
assert f.read() == rev_2.signed_raw()
......
......@@ -228,7 +228,8 @@ def test_tx_passed_all_sources_empty(
# test error
if not is_account_filled:
assert (
"Error: Issuer pubkey FA4uAQ92rmxidQPgtMopaLfNNzhxu7wLgUsUkqKkSwPr:4E7 is empty. No transaction sent."
"Error: Issuer pubkey FA4uAQ92rmxidQPgtMopaLfNNzhxu7wLgUsUkqKkSwPr:4E7 is empty. \
No transaction sent."
in result.output
)
assert result.exit_code == FAILURE_EXIT_STATUS
......
......@@ -437,9 +437,11 @@ def test_get_list_input_for_transaction(
# handle_intermediaries_transactions()
@pytest.mark.parametrize(
"key, issuers, tx_amounts, outputAddresses, Comment, OutputbackChange, expected_listinput_amount",
"key, issuers, tx_amounts, outputAddresses, Comment, \
OutputbackChange, expected_listinput_amount",
[
# test 1 : with two amounts/outputs and an outputbackchange, no need for intermediary transaction.
# test 1: with two amounts/outputs and an outputbackchange
# no need for intermediary transaction
(
key_fifi,
"HcRgKh4LwbQVYuAc3xAdCynYXpKoiPE6qdxCMa8JeHat",
......@@ -471,7 +473,8 @@ def test_get_list_input_for_transaction(
False,
),
),
# test 2 : with 15 amounts/outputs and no outputbackchange, need for intermediary transaction.
# test 2: with 15 amounts/outputs and no outputbackchange,
# need for intermediary transaction
(
key_fifi,
"HcRgKh4LwbQVYuAc3xAdCynYXpKoiPE6qdxCMa8JeHat",
......@@ -859,7 +862,8 @@ def test_handle_intermediaries_transactions(
# test send_transaction()
@pytest.mark.parametrize(
"amounts, amountsud, allsources, recipients, comment, outputbackchange, yes, confirmation_answer",
"amounts, amountsud, allsources, recipients, comment, \
outputbackchange, yes, confirmation_answer",
[
(
[
......@@ -1251,7 +1255,8 @@ def test_generate_and_send_transaction(
# test check_transaction_values()
@pytest.mark.parametrize(
# issuer_pubkey can be invalid. It is only used for display.
"comment, outputAddresses, outputBackChange, enough_source, issuer_pubkey, expected_outputBackchange",
"comment, outputAddresses, outputBackChange, enough_source, \
issuer_pubkey, expected_outputBackchange",
[
(
"Test",
......
......@@ -108,7 +108,8 @@ def test_get_chunks(chunk_size, chunk_from):
assert chunk[0]["number"] + chunk_size - 1 == chunk[-1]["number"]
invalid_signature = "fJusVDRJA8akPse/sv4uK8ekUuvTGj1OoKYVdMQQAACs7OawDfpsV6cEMPcXxrQTCTRMrTN/rRrl20hN5zC9DQ=="
invalid_signature = "fJusVDRJA8akPse/sv4uK8ekUuvTGj1OoKYVdMQQAACs7Oaw\
DfpsV6cEMPcXxrQTCTRMrTN/rRrl20hN5zC9DQ=="
invalid_block_raw = "Version: 10\nType: Block\nCurrency: g1\nNumber: 15144\nPoWMin: 80\n\
Time: 1493683741\nMedianTime: 1493681008\nUnitBase: 0\n\
Issuer: D9D2zaJoWYWveii1JRYLVK3J4Z7ZH3QczoKrnQeiM6mx\nIssuersFrame: 106\n\
......@@ -119,7 +120,8 @@ Identities:\nJoiners:\nActives:\nLeavers:\nRevoked:\nExcluded:\nCertifications:\
Transactions:\nInnerHash: 8B194B5C38CF0A38D16256405AC3E5FA5C2ABD26BE4DCC0C7ED5CC9824E6155B\n\
Nonce: 30400000119992\n"
valid_signature = "qhXtFtl6A/ZL7JMb7guSDlxiISGsHkQ4hTz5mhhdZO0KCLqD2TmvjcGpUFETBSdRYVacvFYOvUANyevlcfx6Ag=="
valid_signature = "qhXtFtl6A/ZL7JMb7guSDlxiISGsHkQ4hTz5mhhdZO0KCLqD2T\
mvjcGpUFETBSdRYVacvFYOvUANyevlcfx6Ag=="
valid_block_raw = "Version: 11\nType: Block\nCurrency: g1-test\nNumber: 509002\n\
PoWMin: 60\nTime: 1580293955\nMedianTime: 1580292050\nUnitBase: 2\n\
Issuer: 5B8iMAzq1dNmFe3ZxFTBQkqhq4fsztg1gZvxHXCk1XYH\nIssuersFrame: 26\n\
......
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