mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-21 19:14:19 +01:00
TokenV3 and new Mint startup in tests (#149)
* tokenv3 send and receive * receive v2 and v1 tokens with tests
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import multiprocessing
|
||||
import shutil
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
@@ -7,6 +9,7 @@ import uvicorn
|
||||
from uvicorn import Config, Server
|
||||
|
||||
from cashu.core.migrations import migrate_databases
|
||||
from cashu.core.settings import settings
|
||||
from cashu.wallet import migrations
|
||||
from cashu.wallet.wallet import Wallet
|
||||
|
||||
@@ -23,15 +26,32 @@ class UvicornServer(multiprocessing.Process):
|
||||
self.terminate()
|
||||
|
||||
def run(self, *args, **kwargs):
|
||||
settings.lightning = False
|
||||
settings.mint_lightning_backend = "FakeWallet"
|
||||
settings.mint_listen_port = 3337
|
||||
settings.mint_database = "data/test_mint"
|
||||
settings.mint_private_key = "privatekeyofthemint"
|
||||
|
||||
dirpath = Path(settings.mint_database)
|
||||
if dirpath.exists() and dirpath.is_dir():
|
||||
shutil.rmtree(dirpath)
|
||||
|
||||
dirpath = Path("data/test_wallet")
|
||||
if dirpath.exists() and dirpath.is_dir():
|
||||
shutil.rmtree(dirpath)
|
||||
|
||||
self.server.run()
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True, scope="session")
|
||||
def mint():
|
||||
|
||||
settings.mint_listen_port = 3337
|
||||
settings.port = 3337
|
||||
settings.mint_url = "http://localhost:3337"
|
||||
settings.port = settings.mint_listen_port
|
||||
config = uvicorn.Config(
|
||||
"cashu.mint.app:app",
|
||||
port=3337,
|
||||
port=settings.mint_listen_port,
|
||||
host="127.0.0.1",
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user