[Mint] add mint api tests (#189)

* add mint api tests

* add /info test and fix NUT-09 contact info strings

* add test mint api

* replace with requests
This commit is contained in:
calle
2023-05-02 00:43:49 +02:00
committed by GitHub
parent 3c47ab2ac7
commit 61078ce7c8
6 changed files with 78 additions and 35 deletions

View File

@@ -1,20 +1,15 @@
from typing import List
import pytest
import pytest_asyncio
from cashu.core.base import BlindedMessage, Proof
from cashu.core.migrations import migrate_databases
SERVER_ENDPOINT = "http://localhost:3338"
import os
from cashu.core.db import Database
from cashu.core.settings import settings
from cashu.lightning.fake import FakeWallet
from cashu.mint import migrations
from cashu.mint.ledger import Ledger
from tests.conftest import ledger
async def assert_err(f, msg):
@@ -32,27 +27,6 @@ def assert_amt(proofs: List[Proof], expected: int):
assert [p.amount for p in proofs] == expected
async def start_mint_init(ledger):
await migrate_databases(ledger.db, migrations)
await ledger.load_used_proofs()
await ledger.init_keysets()
@pytest_asyncio.fixture(scope="function")
async def ledger():
db_file = "data/mint/test.sqlite3"
if os.path.exists(db_file):
os.remove(db_file)
ledger = Ledger(
db=Database("test", "data/mint"),
seed="TEST_PRIVATE_KEY",
derivation_path="0/0/0/0",
lightning=FakeWallet(),
)
await start_mint_init(ledger)
yield ledger
@pytest.mark.asyncio
async def test_pubkeys(ledger: Ledger):
assert ledger.keyset.public_keys