fix: some tests
This commit is contained in:
+10
-3
@@ -95,6 +95,7 @@ async def test_login_alan_username_password_ok(
|
||||
|
||||
payload: dict = jwt.decode(access_token, settings.auth_secret_key, ["HS256"])
|
||||
access_token_payload = AccessTokenPayload(**payload)
|
||||
|
||||
assert access_token_payload.sub == "alan", "Subject is Alan."
|
||||
assert access_token_payload.email == "alan@lnbits.com"
|
||||
assert access_token_payload.auth_time, "Auth time should be set by server."
|
||||
@@ -113,7 +114,9 @@ async def test_login_alan_username_password_ok(
|
||||
assert not user.admin, "Not admin."
|
||||
assert not user.super_user, "Not superuser."
|
||||
assert user.has_password, "Password configured."
|
||||
assert len(user.wallets) == 1, "One default wallet."
|
||||
assert (
|
||||
len(user.wallets) == 1
|
||||
), f"Expected 1 default wallet, not {len(user.wallets)}."
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -221,7 +224,9 @@ async def test_register_ok(http_client: AsyncClient):
|
||||
assert not user.admin, "Not admin."
|
||||
assert not user.super_user, "Not superuser."
|
||||
assert user.has_password, "Password configured."
|
||||
assert len(user.wallets) == 1, "One default wallet."
|
||||
assert (
|
||||
len(user.wallets) == 1
|
||||
), f"Expected 1 default wallet, not {len(user.wallets)}."
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -509,7 +514,9 @@ async def test_register_nostr_ok(http_client: AsyncClient):
|
||||
assert not user.admin, "Not admin."
|
||||
assert not user.super_user, "Not superuser."
|
||||
assert not user.has_password, "Password configured."
|
||||
assert len(user.wallets) == 1, "One default wallet."
|
||||
assert (
|
||||
len(user.wallets) == 1
|
||||
), f"Expected 1 default wallet, not {len(user.wallets)}."
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
+2
-1
@@ -102,7 +102,7 @@ async def db():
|
||||
yield Database("database")
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="package")
|
||||
@pytest_asyncio.fixture(scope="session")
|
||||
async def user_alan():
|
||||
account = await get_account_by_username("alan")
|
||||
if not account:
|
||||
@@ -112,6 +112,7 @@ async def user_alan():
|
||||
username="alan",
|
||||
)
|
||||
account.hash_password("secret1234")
|
||||
account = await create_account(account)
|
||||
yield account
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user