mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-05-09 18:27:56 +08:00
fix test
This commit is contained in:
@@ -4,7 +4,7 @@ from sqlalchemy.sql.functions import func
|
||||
from sqlmodel.sql.expression import select
|
||||
|
||||
|
||||
async def test_add_subscribe(app: App, db_migration):
|
||||
async def test_add_subscribe(app: App, init_scheduler):
|
||||
|
||||
from nonebot_bison.config.db_config import config
|
||||
from nonebot_bison.config.db_model import Subscribe, Target, User
|
||||
@@ -72,7 +72,7 @@ async def test_add_subscribe(app: App, db_migration):
|
||||
assert conf.tags == ["tag"]
|
||||
|
||||
|
||||
async def test_del_subsribe(db_migration):
|
||||
async def test_del_subsribe(init_scheduler):
|
||||
from nonebot_bison.config.db_config import config
|
||||
from nonebot_bison.config.db_model import Subscribe, Target, User
|
||||
from nonebot_bison.types import Target as TTarget
|
||||
@@ -95,7 +95,7 @@ async def test_del_subsribe(db_migration):
|
||||
)
|
||||
async with AsyncSession(get_engine()) as sess:
|
||||
assert (await sess.scalar(select(func.count()).select_from(Subscribe))) == 0
|
||||
assert (await sess.scalar(select(func.count()).select_from(Target))) == 0
|
||||
assert (await sess.scalar(select(func.count()).select_from(Target))) == 1
|
||||
|
||||
await config.add_subscribe(
|
||||
user=123,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import pytest
|
||||
|
||||
|
||||
async def test_migration(use_legacy_config, db_migration):
|
||||
async def test_migration(use_legacy_config):
|
||||
from nonebot_bison.config.config_legacy import config as config_legacy
|
||||
from nonebot_bison.config.db import data_migrate
|
||||
from nonebot_bison.config.db import data_migrate, upgrade_db
|
||||
from nonebot_bison.config.db_config import config
|
||||
|
||||
config_legacy.add_subscribe(
|
||||
@@ -33,7 +33,8 @@ async def test_migration(use_legacy_config, db_migration):
|
||||
cats=[1],
|
||||
tags=[],
|
||||
)
|
||||
await data_migrate()
|
||||
# await data_migrate()
|
||||
await upgrade_db()
|
||||
user123_config = await config.list_subscribe(123, "group")
|
||||
assert len(user123_config) == 2
|
||||
for c in user123_config:
|
||||
|
||||
Reference in New Issue
Block a user