test: lint tests and tools aswell (#2296)

* test: lint `tests` and `tools` aswell

more linting :)

* fix linting issues in tests and tools

* fixup!

* how is this working?
This commit is contained in:
dni ⚡
2024-02-27 13:30:52 +00:00
committed by GitHub
parent e8aa498683
commit 884a1b9d6f
6 changed files with 103 additions and 28 deletions
+1
View File
@@ -109,6 +109,7 @@ async def test_channel_management(node_client):
[channel for channel in data if channel.state == ChannelState.ACTIVE]
)
assert close, "No active channel found"
assert close.point, "No channel point found"
response = await node_client.delete(
"/node/api/v1/channels",
+5 -12
View File
@@ -7,9 +7,9 @@ import time
from subprocess import PIPE, Popen, TimeoutExpired
from typing import Tuple
import psycopg2
from loguru import logger
from sqlalchemy.engine.url import make_url
from psycopg2 import connect
from psycopg2.errors import InvalidCatalogName
from lnbits import core
from lnbits.db import DB_TYPE, POSTGRES
@@ -158,24 +158,17 @@ def pay_onchain(address: str, sats: int) -> str:
def clean_database(settings):
if DB_TYPE == POSTGRES:
db_url = make_url(settings.lnbits_database_url)
conn = psycopg2.connect(settings.lnbits_database_url)
conn = connect(settings.lnbits_database_url)
conn.autocommit = True
with conn.cursor() as cur:
try:
cur.execute("DROP DATABASE lnbits_test")
except psycopg2.errors.InvalidCatalogName:
except InvalidCatalogName:
pass
cur.execute("CREATE DATABASE lnbits_test")
db_url.database = "lnbits_test"
settings.lnbits_database_url = str(db_url)
core.db.__init__("database")
conn.close()
else:
# FIXME: do this once mock data is removed from test data folder
# TODO: do this once mock data is removed from test data folder
# os.remove(settings.lnbits_data_folder + "/database.sqlite3")
pass