1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-22 08:56:17 +00:00
This commit is contained in:
Alban Féron 2023-01-15 16:28:27 +01:00
parent d5a4f1856c
commit be6b617e60
No known key found for this signature in database
GPG Key ID: 8CE0313646D16165
2 changed files with 9 additions and 3 deletions

View File

@ -628,7 +628,9 @@ def init_database(database_uri):
if ext == ".sql":
with db.atomic():
execute_sql_resource_script(f"schema/migration/{provider}/{migration}")
execute_sql_resource_script(
f"schema/migration/{provider}/{migration}"
)
elif ext == ".py":
m = importlib.import_module(
f".schema.migration.{provider}.{date}", __package__

View File

@ -104,7 +104,9 @@ class UserManagerTestCase(unittest.TestCase):
# Delete existing users
for name in ["alice", "bob", "charlie"]:
user = db.User.get(name=name)
db.ClientPrefs.create(user=user, client_name="tests") # test for FK handling
db.ClientPrefs.create(
user=user, client_name="tests"
) # test for FK handling
UserManager.delete(user.id)
self.assertRaises(db.User.DoesNotExist, db.User.__getitem__, user.id)
self.assertEqual(db.User.select().count(), 0)
@ -115,7 +117,9 @@ class UserManagerTestCase(unittest.TestCase):
# Delete existing users
for name in ["alice", "bob", "charlie"]:
user = db.User.get(name=name)
db.ClientPrefs.create(user=user, client_name="tests") # test for FK handling
db.ClientPrefs.create(
user=user, client_name="tests"
) # test for FK handling
UserManager.delete_by_name(name)
self.assertFalse(db.User.select().where(db.User.name == name).exists())