Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ychiucco committed Feb 4, 2025
1 parent c644bdf commit f166355
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
4 changes: 2 additions & 2 deletions fractal_server/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class MailSettings(BaseModel):
recipients: list[EmailStr] = Field(min_items=1)
smtp_server: str
port: int
encrypted_password: str
encryption_key: str
encrypted_password: Optional[str] = None
encryption_key: Optional[str] = None
instance_name: str
use_starttls: bool
use_login: bool
Expand Down
28 changes: 16 additions & 12 deletions tests/no_version/test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@
from fractal_server.app.models import OAuthAccount
from fractal_server.app.models import UserOAuth
from fractal_server.app.security import get_user_manager
from fractal_server.config import MailSettings


async def test_server_not_available(override_settings_factory, db, caplog):
override_settings_factory(
FRACTAL_EMAIL_PASSWORD=(
"gAAAAABnoQUGHMsDgLkpDtwUtrKtf9T1so44ahEXExGRceAnf097mVY1EbNuMP5fj"
"vkndvwCwBJM7lHoSgKQkZ4VbvO9t3PJZg=="
),
FRACTAL_EMAIL_PASSWORD_KEY=(
"lp3j2FVDkzLd0Rklnzg1pHuV9ClCuDE0aGeJfTNCaW4="
),
FRACTAL_EMAIL_RECIPIENTS="test@example.org",
FRACTAL_EMAIL_SENDER="fractal@fractal.fractal",
FRACTAL_EMAIL_SMTP_SERVER="localhost",
FRACTAL_EMAIL_SMTP_PORT="1234",
FRACTAL_EMAIL_INSTANCE_NAME="fractal",
FRACTAL_EMAIL_SETTINGS=MailSettings(
sender="fractal@fractal.fractal",
recipients=["test@example.org"],
smtp_server="localhost",
port=1234,
encrypted_password=(
"gAAAAABnoQUGHMsDgLkpDtwUtrKtf9T1so44ahEXExGRceAnf097mVY1EbNuM"
"P5fjvkndvwCwBJM7lHoSgKQkZ4VbvO9t3PJZg=="
),
encryption_key="lp3j2FVDkzLd0Rklnzg1pHuV9ClCuDE0aGeJfTNCaW4=",
instance_name="fractal",
use_starttls=False,
use_login=True,
)
)
user = UserOAuth(
email="user@example.org",
Expand Down Expand Up @@ -49,5 +52,6 @@ async def test_server_not_available(override_settings_factory, db, caplog):

async with contextlib.asynccontextmanager(get_user_manager)() as um:
await um.on_after_register(user)

assert "ERROR sending notification email" in caplog.text
assert "[Errno 111] Connection refused" in caplog.text
2 changes: 1 addition & 1 deletion tests/v2/06_tasks_lifecycle/test_unit_bash_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_template_2(
settings = Settings(
**Settings(
FRACTAL_PIP_CACHE_DIR=(tmp_path / "CACHE_DIR").as_posix()
).dict()
).dict(exclude_unset=True)
)
path = tmp_path / "unit_templates"
venv_path = path / "venv"
Expand Down

0 comments on commit f166355

Please sign in to comment.