tests: fix missing / in sqlite paths

This commit is contained in:
Éloi Rivard 2025-01-10 10:53:15 +01:00
parent 7e01008ac0
commit a25bfe0b3a
No known key found for this signature in database
GPG key ID: 7EDA204EA57DD184

View file

@ -44,18 +44,19 @@ def test_configuration_from_environment_vars(tmp_path):
"""Canaille should read configuration from environment vars.""" """Canaille should read configuration from environment vars."""
os.environ["SECRET_KEY"] = "very-very-secret" os.environ["SECRET_KEY"] = "very-very-secret"
os.environ["CANAILLE__SMTP__FROM_ADDR"] = "user@mydomain.test" os.environ["CANAILLE__SMTP__FROM_ADDR"] = "user@mydomain.test"
os.environ["CANAILLE_SQL__DATABASE_URI"] = f"sqlite://{tmp_path}/anything.db" os.environ["CANAILLE_SQL__DATABASE_URI"] = f"sqlite:///{tmp_path}/anything.db"
conf = settings_factory({"TIMEZONE": "UTC"}) conf = settings_factory({"TIMEZONE": "UTC"})
assert conf.SECRET_KEY == "very-very-secret" assert conf.SECRET_KEY == "very-very-secret"
assert conf.CANAILLE.SMTP.FROM_ADDR == "user@mydomain.test" assert conf.CANAILLE.SMTP.FROM_ADDR == "user@mydomain.test"
assert conf.CANAILLE_SQL.DATABASE_URI == f"sqlite://{tmp_path}/anything.db" assert conf.CANAILLE_SQL.DATABASE_URI == f"sqlite:///{tmp_path}/anything.db"
app = create_app({"TIMEZONE": "UTC"}) app = create_app({"TIMEZONE": "UTC"})
assert app.config["SECRET_KEY"] == "very-very-secret" assert app.config["SECRET_KEY"] == "very-very-secret"
assert app.config["CANAILLE"]["SMTP"]["FROM_ADDR"] == "user@mydomain.test" assert app.config["CANAILLE"]["SMTP"]["FROM_ADDR"] == "user@mydomain.test"
assert ( assert (
app.config["CANAILLE_SQL"]["DATABASE_URI"] == f"sqlite://{tmp_path}/anything.db" app.config["CANAILLE_SQL"]["DATABASE_URI"]
== f"sqlite:///{tmp_path}/anything.db"
) )
del os.environ["SECRET_KEY"] del os.environ["SECRET_KEY"]