Skip to content
Snippets Groups Projects
Commit b529481b authored by matograine's avatar matograine Committed by Moul
Browse files

[enh] membership: Migrate from tabulate to texttable (#203)

update related tests
parent c97dfe3f
No related branches found
No related tags found
1 merge request!199#203: Harmonize tables style using Texttable
......@@ -21,7 +21,6 @@ import pendulum
from duniterpy.api import bma
from duniterpy.documents import BlockID, Membership, get_block_id
from duniterpy.key import SigningKey
from tabulate import tabulate
from silkaj import auth, tui, wot
from silkaj.blockchain_tools import get_blockchain_parameters, get_head_block
......@@ -90,7 +89,7 @@ def display_confirmation_table(
Check whether there is pending memberships already in the mempool
Display their expiration date
Actually, it works sending a membership document even if the time
Actually, sending a membership document works even if the time
between two renewals is not awaited as for the certification
"""
......@@ -152,7 +151,9 @@ def display_confirmation_table(
]
)
click.echo(tabulate(table, tablefmt="fancy_grid"))
display_table = tui.Table()
display_table.fill_rows(table)
click.echo(display_table.draw())
def generate_membership_document(
......
......@@ -21,7 +21,6 @@ from click.testing import CliRunner
from duniterpy.api import bma
from duniterpy.documents import Membership, get_block_id
from duniterpy.key import SigningKey
from tabulate import tabulate
from patched.blockchain_tools import (
currency,
......@@ -34,12 +33,11 @@ from patched.wot import (
patched_wot_requirements_no_pending,
patched_wot_requirements_one_pending,
)
from silkaj import auth, blockchain_tools, membership, wot
from silkaj import auth, blockchain_tools, membership, tui, wot
from silkaj.blockchain_tools import get_blockchain_parameters
from silkaj.cli import cli
from silkaj.constants import DATE
from silkaj.network_tools import client_instance
from silkaj.tui import gen_pubkey_checksum
# Values and patches
PUBKEY = "EA7Dsw39ShZg4SpURsrgMaMqrweJPUFPYHwZA8e92e3D"
......@@ -167,7 +165,7 @@ def test_display_confirmation_table(patched_wot_requirements, monkeypatch, capsy
)
table.append(["User Identifier (UID)", identity_uid])
table.append(["Public Key", gen_pubkey_checksum(PUBKEY)])
table.append(["Public Key", tui.gen_pubkey_checksum(PUBKEY)])
table.append(["Block Identity", str(identity_block_id)[:45] + ""])
......@@ -194,7 +192,9 @@ def test_display_confirmation_table(patched_wot_requirements, monkeypatch, capsy
]
)
expected = tabulate(table, tablefmt="fancy_grid") + "\n"
display_table = tui.Table()
display_table.fill_rows(table)
expected = display_table.draw() + "\n"
membership.display_confirmation_table(identity_uid, PUBKEY, identity_block_id)
captured = capsys.readouterr()
......
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