fix(tests): test setup

This commit is contained in:
fusion44 2022-08-24 19:19:58 +02:00
parent fcb23c2fc0
commit 304bbc8c74
4 changed files with 11 additions and 15 deletions

View file

@ -1,14 +1,16 @@
from starlette.testclient import TestClient
from app.main import app
from app.models.lightning import LightningInfoLite
from app.routers import lightning
from tests.routers.test_lightning_utils import get_valid_lightning_info_lite
from tests.routers.utils import call_route
from tests.utils import monkeypatch_auth
from .test_lightning_utils import get_valid_lightning_info_lite
test_client = TestClient(app)
def test_route_authentications_latest(test_client: TestClient):
def test_route_authentications_latest():
prefixes = ["/latest/lightning", "/v1/lightning"]
for prefix in prefixes:
@ -33,7 +35,7 @@ def test_route_authentications_latest(test_client: TestClient):
call_route(test_client, f"{prefix}/unlock-wallet", params=p, method="p")
def test_get_ln_status(test_client: TestClient, monkeypatch):
def test_get_ln_status(monkeypatch):
prefix_latest = "/latest/lightning"
prefix_v1 = "/v1/lightning"

View file

@ -5,6 +5,7 @@ def get_valid_lightning_info_lite() -> LightningInfoLite:
return LightningInfoLite(
implementation="LND",
version="0.13.1",
identity_pubkey="0246ad12eb40bcf26a0cd50757b15a58181d0ad0d78d5bc31e8058205321c3e632",
num_pending_channels=1,
num_active_channels=4,
num_inactive_channels=2,

View file

@ -1,10 +1,13 @@
from starlette.testclient import TestClient
from app.main import app
from tests.routers.utils import call_route
client = TestClient(app)
def test_route_authentications_latest(test_client: TestClient):
def test_route_authentications_latest():
prefixes = ["/latest/system", "/v1/system"]
for prefix in prefixes:
call_route(test_client, f"{prefix}/refresh-token", method="p")
call_route(client, f"{prefix}/refresh-token", method="p")

View file

@ -1,10 +0,0 @@
import pytest
from starlette.testclient import TestClient
from app.main import app
@pytest.fixture(scope="module")
def test_client():
client = TestClient(app)
yield client