From 516550bd9f4e7cc0cbc2934cf12ffc73d66fc9f6 Mon Sep 17 00:00:00 2001 From: fusion44 Date: Sun, 20 Mar 2022 17:20:56 +0100 Subject: [PATCH] chore: format source using the pre_commit command --- .env_sample | 10 +++++----- .vscode/launch.json | 3 --- app/auth/auth_bearer.py | 2 +- app/external/fastapi_versioning/README.md | 4 ++-- app/external/sse_startlette/LICENSE.md | 2 +- app/external/sse_startlette/sse_starlette.py | 2 +- app/models/bitcoind.py | 1 + app/models/lightning.py | 3 ++- app/models/lightning_docs.py | 2 +- app/models/system.py | 8 ++++---- app/repositories/bitcoin.py | 5 +++-- app/repositories/hardware_impl/native_python.py | 1 - app/repositories/lightning.py | 11 ++++++----- app/repositories/ln_impl/lnd.py | 7 ++++--- app/repositories/ln_impl/protos/lightning_pb2.py | 2 +- app/repositories/ln_impl/protos/router_pb2.py | 6 +++--- app/repositories/ln_impl/protos/signer_pb2_grpc.py | 1 - .../ln_impl/protos/walletunlocker_pb2.py | 1 - .../ln_impl/protos/walletunlocker_pb2_grpc.py | 1 - app/repositories/system.py | 5 +++-- app/repositories/system_impl/native_python.py | 3 ++- app/routers/apps.py | 5 +++-- app/routers/bitcoin.py | 5 +++-- app/routers/lightning.py | 11 ++++++----- app/routers/lightning_docs.py | 12 ++++++------ app/routers/setup.py | 7 ++++--- app/routers/system.py | 7 ++++--- app/routers/system_docs.py | 6 +++--- scripts/sync_to_blitz.sh | 4 ++-- tests/routers/test_lightning.py | 3 ++- tests/routers/test_system.py | 1 + tests/{conftest.py => test_conf.py} | 3 ++- tests/utils.py | 3 ++- 33 files changed, 78 insertions(+), 69 deletions(-) rename tests/{conftest.py => test_conf.py} (99%) diff --git a/.env_sample b/.env_sample index c592a42..1867b76 100644 --- a/.env_sample +++ b/.env_sample @@ -12,14 +12,14 @@ login_password=12345678 # enable_local_cookie_auth = false # Platform tells the backend on what kind of system it is running on. -# Different platforms might use different data sources and might yield +# Different platforms might use different data sources and might yield # different kinds of data. E.g.: If set to "raspiblitz",then hardware # information will be fetched from Redis instead of the native python implementation. # In case of native_python set other optional config vars np_* further below. # supported values: [raspiblitz, native_python] # platform=raspiblitz -# Amount of seconds the app will wait until it'll +# Amount of seconds the app will wait until it'll # send another hardware update # only applies when platform=native_python gather_hw_info_interval = 2 @@ -27,7 +27,7 @@ gather_hw_info_interval = 2 # Amount of seconds the app will gather CPU usage data for each update # The resulting CPU usage is averaged over this period of time. # To get realistic results at least 0.1 seconds is recommended -# must be less than and not equal to gather_hw_info_interval +# must be less than and not equal to gather_hw_info_interval # only applies when platform=native_python cpu_usage_averaging_period = 0.5 @@ -43,7 +43,7 @@ shell_script_path = /home/admin # default: false # sse_notify_forward_successes=false -# If set to 0 all forward event will be sent instantly, otherwise they'll +# If set to 0 all forward event will be sent instantly, otherwise they'll # be gathered and sent as an array of notifications. # This also affects how often the wallet balance is updated (even if sse_notify_forward_successes is false) # default: 2.0 seconds @@ -107,4 +107,4 @@ lnd_rest_port=8080 # np_ssh_address="username@192.168.1.50" # Version of the platform. Ignored on platform Raspiblitz -# np_version="v0.5.0beta" \ No newline at end of file +# np_version="v0.5.0beta" diff --git a/.vscode/launch.json b/.vscode/launch.json index 49d584b..ccad879 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,7 +1,4 @@ { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { diff --git a/app/auth/auth_bearer.py b/app/auth/auth_bearer.py index c7d7e2c..5490a33 100644 --- a/app/auth/auth_bearer.py +++ b/app/auth/auth_bearer.py @@ -1,5 +1,5 @@ from fastapi import HTTPException, Request, status -from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials +from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer from .auth_handler import decodeJWT diff --git a/app/external/fastapi_versioning/README.md b/app/external/fastapi_versioning/README.md index 1021a65..c546618 100644 --- a/app/external/fastapi_versioning/README.md +++ b/app/external/fastapi_versioning/README.md @@ -1,9 +1,9 @@ # FastAPI Versioning -* Original: https://github.com/DeanWay/fastapi-versioning +* Original: https://github.com/DeanWay/fastapi-versioning * Fork: https://github.com/fusion44/fastapi-versioning TODO: Replace with original, once [this PR](https://github.com/DeanWay/fastapi-versioning/pull/59) is approved and released. Background: -https://github.com/fusion44/blitz_api/issues/40 \ No newline at end of file +https://github.com/fusion44/blitz_api/issues/40 diff --git a/app/external/sse_startlette/LICENSE.md b/app/external/sse_startlette/LICENSE.md index 9d53f98..3d12971 100644 --- a/app/external/sse_startlette/LICENSE.md +++ b/app/external/sse_startlette/LICENSE.md @@ -24,4 +24,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/app/external/sse_startlette/sse_starlette.py b/app/external/sse_startlette/sse_starlette.py index f7921c8..49a6b2d 100644 --- a/app/external/sse_startlette/sse_starlette.py +++ b/app/external/sse_startlette/sse_starlette.py @@ -22,7 +22,7 @@ from starlette.types import Receive, Scope, Send class AppStatus: - """ helper for monkeypatching the signal-handler of uvicorn """ + """helper for monkeypatching the signal-handler of uvicorn""" should_exit = False diff --git a/app/models/bitcoind.py b/app/models/bitcoind.py index e6d8a7f..c9f7600 100644 --- a/app/models/bitcoind.py +++ b/app/models/bitcoind.py @@ -1,5 +1,6 @@ from enum import Enum from typing import List, Optional + from fastapi import Query from pydantic.main import BaseModel diff --git a/app/models/lightning.py b/app/models/lightning.py index 0b59d27..04094d0 100644 --- a/app/models/lightning.py +++ b/app/models/lightning.py @@ -1,12 +1,13 @@ from enum import Enum from typing import List, Optional, Union -import app.models.lightning_docs as docs from deepdiff import DeepDiff from fastapi.param_functions import Query from pydantic import BaseModel from pydantic.types import conint +import app.models.lightning_docs as docs + class OnchainAddressType(str, Enum): P2WKH = "p2wkh" diff --git a/app/models/lightning_docs.py b/app/models/lightning_docs.py index ca15823..4b7dc51 100644 --- a/app/models/lightning_docs.py +++ b/app/models/lightning_docs.py @@ -1,5 +1,5 @@ tx_id_desc = """ -Unique identifier for this transaction. +Unique identifier for this transaction. Depending on the type of the transaction it will be different: #### On-chain diff --git a/app/models/system.py b/app/models/system.py index 0ae3541..5832211 100644 --- a/app/models/system.py +++ b/app/models/system.py @@ -1,14 +1,14 @@ from enum import Enum from typing import List, Optional -from app.models.lightning import LnInfo -from app.routers.system_docs import get_debug_data_sample_str from decouple import config from fastapi import Query from fastapi.param_functions import Query from pydantic import BaseModel from pydantic.types import constr +from app.routers.system_docs import get_debug_data_sample_str + class LoginInput(BaseModel): password: constr(min_length=8) @@ -29,7 +29,7 @@ class HealthMessage(BaseModel): id: int = Query( None, description="""ID of the message. -Idea behind the ID is that messages can be replacable on the client. +Idea behind the ID is that messages can be replacable on the client. To prevent spamming the user with multiple messages, message with ID 25 will be replaced with never data of ID 25 """, example=""" @@ -44,7 +44,7 @@ To prevent spamming the user with multiple messages, message with ID 25 will be level: HealthMessagePriority = Query( HealthMessagePriority.INFO, description="""Priority level of the message. For more info see `message`. - + `INFO`: FYI, can normally be ignored.\n `WARNING`: Potential problem might occur, user interaction possibly required.\n `ERROR`: Something bad happened. User interaction definitely required. diff --git a/app/repositories/bitcoin.py b/app/repositories/bitcoin.py index fe43218..f851dcf 100644 --- a/app/repositories/bitcoin.py +++ b/app/repositories/bitcoin.py @@ -5,12 +5,13 @@ import logging import zmq import zmq.asyncio -from app.models.bitcoind import BlockchainInfo, BtcInfo, FeeEstimationMode, NetworkInfo -from app.utils import SSE, bitcoin_config, bitcoin_rpc_async, send_sse_message from fastapi import Request from fastapi.exceptions import HTTPException from starlette import status +from app.models.bitcoind import BlockchainInfo, BtcInfo, FeeEstimationMode, NetworkInfo +from app.utils import SSE, bitcoin_config, bitcoin_rpc_async, send_sse_message + async def get_blockchain_info() -> BlockchainInfo: result = await bitcoin_rpc_async("getblockchaininfo") diff --git a/app/repositories/hardware_impl/native_python.py b/app/repositories/hardware_impl/native_python.py index 73347f4..cc4c796 100644 --- a/app/repositories/hardware_impl/native_python.py +++ b/app/repositories/hardware_impl/native_python.py @@ -1,7 +1,6 @@ import psutil from decouple import config - SLEEP_TIME = config("gather_hw_info_interval", default=2, cast=float) CPU_AVG_PERIOD = config("cpu_usage_averaging_period", default=0.5, cast=float) HW_INFO_YIELD_TIME = SLEEP_TIME + CPU_AVG_PERIOD diff --git a/app/repositories/lightning.py b/app/repositories/lightning.py index 662a8da..36c38ca 100644 --- a/app/repositories/lightning.py +++ b/app/repositories/lightning.py @@ -1,6 +1,10 @@ import asyncio -from typing import List, Optional import logging +from typing import List, Optional + +from decouple import config +from fastapi import status +from fastapi.exceptions import HTTPException from app.models.lightning import ( FeeRevenue, @@ -16,9 +20,6 @@ from app.models.lightning import ( SendCoinsResponse, ) from app.utils import SSE, lightning_config, send_sse_message -from decouple import config -from fastapi import status -from fastapi.exceptions import HTTPException if lightning_config.ln_node == "lnd": from app.repositories.ln_impl.lnd import ( @@ -181,7 +182,7 @@ Unable to connect to LND. Possible reasons: * Node is not reachable (ports, network down, ...) * Maccaroon is not correct * IP is not included in LND tls certificate - Add tlsextraip=192.168.1.xxx to lnd.conf and restart LND. + Add tlsextraip=192.168.1.xxx to lnd.conf and restart LND. This will recreate the TLS certificate. The .env must be adpted accordingly. * TLS certificate is wrong. (settings changed, ...) diff --git a/app/repositories/ln_impl/lnd.py b/app/repositories/ln_impl/lnd.py index ae9f4ae..e561c6c 100644 --- a/app/repositories/ln_impl/lnd.py +++ b/app/repositories/ln_impl/lnd.py @@ -1,10 +1,13 @@ import asyncio from typing import List, Optional +import grpc +from fastapi.exceptions import HTTPException +from starlette import status + import app.repositories.ln_impl.protos.lightning_pb2 as ln import app.repositories.ln_impl.protos.router_pb2 as router import app.repositories.ln_impl.protos.walletunlocker_pb2 as unlocker -import grpc from app.models.lightning import ( FeeRevenue, ForwardSuccessEvent, @@ -24,8 +27,6 @@ from app.models.lightning import ( from app.utils import SSE from app.utils import lightning_config as lncfg from app.utils import send_sse_message -from fastapi.exceptions import HTTPException -from starlette import status def get_implementation_name() -> str: diff --git a/app/repositories/ln_impl/protos/lightning_pb2.py b/app/repositories/ln_impl/protos/lightning_pb2.py index 3d673ef..58b54c7 100644 --- a/app/repositories/ln_impl/protos/lightning_pb2.py +++ b/app/repositories/ln_impl/protos/lightning_pb2.py @@ -2,11 +2,11 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: lightning.proto """Generated protocol buffer code.""" -from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import enum_type_wrapper # @@protoc_insertion_point(imports) diff --git a/app/repositories/ln_impl/protos/router_pb2.py b/app/repositories/ln_impl/protos/router_pb2.py index 0c175a8..644529a 100644 --- a/app/repositories/ln_impl/protos/router_pb2.py +++ b/app/repositories/ln_impl/protos/router_pb2.py @@ -2,13 +2,13 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: router.proto """Generated protocol buffer code.""" -import app.repositories.ln_impl.protos.lightning_pb2 as lightning__pb2 - -from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import enum_type_wrapper + +import app.repositories.ln_impl.protos.lightning_pb2 as lightning__pb2 # @@protoc_insertion_point(imports) diff --git a/app/repositories/ln_impl/protos/signer_pb2_grpc.py b/app/repositories/ln_impl/protos/signer_pb2_grpc.py index 3c52b1f..e916c8c 100644 --- a/app/repositories/ln_impl/protos/signer_pb2_grpc.py +++ b/app/repositories/ln_impl/protos/signer_pb2_grpc.py @@ -1,7 +1,6 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! """Client and server classes corresponding to protobuf-defined services.""" import grpc - import signer_pb2 as signer__pb2 diff --git a/app/repositories/ln_impl/protos/walletunlocker_pb2.py b/app/repositories/ln_impl/protos/walletunlocker_pb2.py index c83aa46..b75850a 100644 --- a/app/repositories/ln_impl/protos/walletunlocker_pb2.py +++ b/app/repositories/ln_impl/protos/walletunlocker_pb2.py @@ -14,7 +14,6 @@ _sym_db = _symbol_database.Default() import app.repositories.ln_impl.protos.lightning_pb2 as lightning__pb2 - DESCRIPTOR = _descriptor.FileDescriptor( name="walletunlocker.proto", package="lnrpc", diff --git a/app/repositories/ln_impl/protos/walletunlocker_pb2_grpc.py b/app/repositories/ln_impl/protos/walletunlocker_pb2_grpc.py index bda1e56..5e4b29b 100644 --- a/app/repositories/ln_impl/protos/walletunlocker_pb2_grpc.py +++ b/app/repositories/ln_impl/protos/walletunlocker_pb2_grpc.py @@ -2,7 +2,6 @@ """Client and server classes corresponding to protobuf-defined services.""" import grpc - import app.repositories.ln_impl.protos.walletunlocker_pb2 as walletunlocker__pb2 diff --git a/app/repositories/system.py b/app/repositories/system.py index 551800b..9d81ce7 100644 --- a/app/repositories/system.py +++ b/app/repositories/system.py @@ -1,11 +1,12 @@ import asyncio from os import path -from app.models.system import APIPlatform, RawDebugLogData, SystemInfo -from app.utils import SSE, send_sse_message from decouple import config from fastapi import HTTPException, Request, status +from app.models.system import APIPlatform, RawDebugLogData, SystemInfo +from app.utils import SSE, send_sse_message + PLATFORM = config("platform", default=APIPlatform.RASPIBLITZ) if PLATFORM == APIPlatform.RASPIBLITZ: from app.repositories.hardware_impl.raspiblitz import ( diff --git a/app/repositories/system_impl/native_python.py b/app/repositories/system_impl/native_python.py index 93aa50c..160ac60 100644 --- a/app/repositories/system_impl/native_python.py +++ b/app/repositories/system_impl/native_python.py @@ -1,3 +1,5 @@ +from decouple import config + from app.constants import API_VERSION from app.models.system import ( APIPlatform, @@ -7,7 +9,6 @@ from app.models.system import ( SystemInfo, ) from app.repositories.lightning import get_ln_info -from decouple import config async def get_system_info_impl() -> SystemInfo: diff --git a/app/routers/apps.py b/app/routers/apps.py index 147595b..8335237 100644 --- a/app/routers/apps.py +++ b/app/routers/apps.py @@ -1,9 +1,10 @@ +from fastapi import APIRouter, HTTPException, status +from fastapi.params import Depends + import app.repositories.apps as repo import app.routers.apps_docs as docs from app.auth.auth_bearer import JWTBearer from app.external.sse_startlette import EventSourceResponse -from fastapi import APIRouter, HTTPException, status -from fastapi.params import Depends _PREFIX = "apps" diff --git a/app/routers/bitcoin.py b/app/routers/bitcoin.py index 8681d5c..64deb44 100644 --- a/app/routers/bitcoin.py +++ b/app/routers/bitcoin.py @@ -1,3 +1,6 @@ +from fastapi import APIRouter, HTTPException, Request, status +from fastapi.params import Depends, Query + from app.auth.auth_bearer import JWTBearer from app.external.sse_startlette import EventSourceResponse from app.models.bitcoind import BlockchainInfo, BtcInfo, FeeEstimationMode, NetworkInfo @@ -10,8 +13,6 @@ from app.repositories.bitcoin import ( ) from app.routers.bitcoin_docs import blocks_sub_doc, estimate_fee_mode_desc from app.utils import bitcoin_rpc -from fastapi import APIRouter, HTTPException, Request, status -from fastapi.params import Depends, Query _PREFIX = "bitcoin" diff --git a/app/routers/lightning.py b/app/routers/lightning.py index 0e09c92..87d8a01 100644 --- a/app/routers/lightning.py +++ b/app/routers/lightning.py @@ -1,5 +1,8 @@ from typing import List, Optional +from fastapi import APIRouter, HTTPException, Query, status +from fastapi.params import Depends + from app.auth.auth_bearer import JWTBearer from app.models.lightning import ( FeeRevenue, @@ -38,8 +41,6 @@ from app.routers.lightning_docs import ( send_coins_desc, send_payment_desc, ) -from fastapi import APIRouter, HTTPException, Query, status -from fastapi.params import Depends _PREFIX = "lightning" @@ -93,8 +94,8 @@ async def getwalletbalance(): name=f"{_PREFIX}.get-fee-revenue", summary="Returns the daily, weekly and monthly fee revenue earned.", description=""" -Currently, year and total fees are always null. Backends don't return these values by default. -Implementation in BlitzAPI is a [to-do](https://github.com/fusion44/blitz_api/issues/64). +Currently, year and total fees are always null. Backends don't return these values by default. +Implementation in BlitzAPI is a [to-do](https://github.com/fusion44/blitz_api/issues/64). """, dependencies=[Depends(JWTBearer())], response_model=FeeRevenue, @@ -113,7 +114,7 @@ async def get_fee_revenue_path() -> FeeRevenue: "/list-all-tx", name=f"{_PREFIX}.list-all-tx", summary="Lists all on-chain transactions, payments and invoices in the wallet", - description="""Returns a list with all on-chain transaction, payments and invoices combined into one list. + description="""Returns a list with all on-chain transaction, payments and invoices combined into one list. The index of each tx is only valid for each identical set of parameters. """, dependencies=[Depends(JWTBearer())], diff --git a/app/routers/lightning_docs.py b/app/routers/lightning_docs.py index 069fe26..5942e56 100644 --- a/app/routers/lightning_docs.py +++ b/app/routers/lightning_docs.py @@ -1,6 +1,6 @@ get_balance_response_desc = """ -A JSON String with on chain wallet balances with on-chain balances in -**sat** and channel balances in **msat**. Detailed description is in +A JSON String with on chain wallet balances with on-chain balances in +**sat** and channel balances in **msat**. Detailed description is in the schema""" new_address_desc = """ @@ -10,16 +10,16 @@ Generate a wallet new address. Address-types has to be one of: """ send_coins_desc = """ -__send-coins__ executes a request to send coins to a particular address. +__send-coins__ executes a request to send coins to a particular address. -### LND: +### LND: If neither __target_conf__, or __sat_per_vbyte__ are set, then the internal wallet will consult its fee model to determine a fee for the default confirmation target. > 👉 See [https://api.lightning.community/?shell#sendcoins](https://api.lightning.community/?shell#sendcoins) -### c-lightning: +### c-lightning: * Set __target_conf__ ==1: interpreted as urgent (aim for next block) -* Set __target_conf__ >=2: interpreted as normal (next 4 blocks or so, **default**) +* Set __target_conf__ >=2: interpreted as normal (next 4 blocks or so, **default**) * Set __target_cont__ >=10: interpreted as slow (next 100 blocks or so) * If __sat_per_vbyte__ is set then __target_conf__ is ignored and vbytes (sipabytes) will be used. diff --git a/app/routers/setup.py b/app/routers/setup.py index 1f87432..379bd99 100644 --- a/app/routers/setup.py +++ b/app/routers/setup.py @@ -2,13 +2,14 @@ import asyncio import logging from aioredis import Redis -from app.auth.auth_bearer import JWTBearer -from app.auth.auth_handler import signJWT -from app.utils import redis_get from fastapi import APIRouter, HTTPException, status from fastapi.params import Depends from fastapi_plugins import depends_redis +from app.auth.auth_bearer import JWTBearer +from app.auth.auth_handler import signJWT +from app.utils import redis_get + router = APIRouter(prefix="/setup", tags=["Setup"]) # can always be called without credentials to check if diff --git a/app/routers/system.py b/app/routers/system.py index 32b745e..4982dd4 100644 --- a/app/routers/system.py +++ b/app/routers/system.py @@ -1,5 +1,9 @@ import secrets +from decouple import config +from fastapi import APIRouter, HTTPException, Request, status +from fastapi.params import Depends + from app.auth.auth_bearer import JWTBearer from app.auth.auth_handler import signJWT from app.external.sse_startlette import EventSourceResponse @@ -17,9 +21,6 @@ from app.routers.system_docs import ( get_debug_logs_raw_summary, get_hw_info_json, ) -from decouple import config -from fastapi import APIRouter, HTTPException, Request, status -from fastapi.params import Depends _PREFIX = "system" diff --git a/app/routers/system_docs.py b/app/routers/system_docs.py index 8a19a01..6589114 100644 --- a/app/routers/system_docs.py +++ b/app/routers/system_docs.py @@ -81,7 +81,7 @@ get_hw_info_json = """ get_debug_data_sample_str = """ *************************************************************** -* RASPIBLITZ DEBUG LOGS +* RASPIBLITZ DEBUG LOGS *************************************************************** blitzversion: 1.7.0 chainnetwork: bitcoin / main @@ -371,8 +371,8 @@ use the following command and share the resulting link: get_debug_logs_raw_summary = "Get raw system logs as a text string." get_debug_logs_raw_desc = """ -This endpoint will gather latest system logs and return it in a -raw string. This endpoint will **not** return immediately because +This endpoint will gather latest system logs and return it in a +raw string. This endpoint will **not** return immediately because it gathers all data on time of the request. """ diff --git a/scripts/sync_to_blitz.sh b/scripts/sync_to_blitz.sh index f214b20..1787b10 100644 --- a/scripts/sync_to_blitz.sh +++ b/scripts/sync_to_blitz.sh @@ -17,7 +17,7 @@ if [ ${sshpassInstalled} -eq 0 ]; then echo "FAIL: please make sure that sshpass is installed on your system" echo "macOS: brew install hudochenkov/sshpass/sshpass" echo "Linux(Debian): apt install sshpass" - exit + exit fi # check if ping is installed @@ -25,7 +25,7 @@ pingInstalled=$(ping -V | grep -c "ping") if [ ${pingInstalled} -eq 0 ]; then echo "FAIL: please make sure that ping is installed on your system" echo "Linux(Debian): apt install inetutils-ping OR apt install iputils-ping" - exit + exit fi # check if localIP is available&responding diff --git a/tests/routers/test_lightning.py b/tests/routers/test_lightning.py index c44f504..752f131 100644 --- a/tests/routers/test_lightning.py +++ b/tests/routers/test_lightning.py @@ -1,6 +1,7 @@ +from starlette.testclient import TestClient + from app.models.lightning import LightningInfoLite from app.routers import lightning -from starlette.testclient import TestClient from tests.routers.utils import call_route from tests.utils import monkeypatch_auth diff --git a/tests/routers/test_system.py b/tests/routers/test_system.py index 7a2ccec..33de6f4 100644 --- a/tests/routers/test_system.py +++ b/tests/routers/test_system.py @@ -1,4 +1,5 @@ from starlette.testclient import TestClient + from tests.routers.utils import call_route diff --git a/tests/conftest.py b/tests/test_conf.py similarity index 99% rename from tests/conftest.py rename to tests/test_conf.py index 366d988..6c117e3 100644 --- a/tests/conftest.py +++ b/tests/test_conf.py @@ -1,7 +1,8 @@ import pytest -from app.main import app from starlette.testclient import TestClient +from app.main import app + @pytest.fixture(scope="module") def test_client(): diff --git a/tests/utils.py b/tests/utils.py index ca30af0..d07385c 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,6 +1,7 @@ -from app.auth.auth_bearer import JWTBearer from fastapi.security import HTTPAuthorizationCredentials +from app.auth.auth_bearer import JWTBearer + def monkeypatch_auth(monkeypatch): async def fake__call__(self, request):