Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor(api): enable strict typing for fix app site missing tests (#43840)

Rao Taodfe46b4dcbdb
diff --git a/api/tests/unit_tests/commands/test_fix_app_site_missing.py b/api/tests/unit_tests/commands/test_fix_app_site_missing.py
index c69f4eb6463..8666429fc97 100644
--- a/api/tests/unit_tests/commands/test_fix_app_site_missing.py
+++ b/api/tests/unit_tests/commands/test_fix_app_site_missing.py
@@ -66,6 +66,13 @@ def _bind_command_database(
return command_sessions, command_session
+def _run_fix_app_site_missing() -> None:
+ """Invoke the command callback through a narrowed, non-optional reference."""
+ callback = system_commands.fix_app_site_missing.callback
+ assert callback is not None
+ callback()
+
+
def test_fix_app_site_missing_passes_loaded_session_to_signal(
monkeypatch: pytest.MonkeyPatch,
sqlite_engine: Engine,
@@ -89,7 +96,7 @@ def test_fix_app_site_missing_passes_loaded_session_to_signal(
monkeypatch.setattr(system_commands.app_was_created, "send", send)
try:
- system_commands.fix_app_site_missing.callback()
+ _run_fix_app_site_missing()
finally:
command_sessions.remove()
@@ -123,7 +130,7 @@ def test_fix_app_site_missing_rolls_back_when_signal_fails(
monkeypatch.setattr(system_commands.app_was_created, "send", MagicMock(side_effect=fail_signal))
try:
- system_commands.fix_app_site_missing.callback()
+ _run_fix_app_site_missing()
finally:
command_sessions.remove()
diff --git a/api/tests/unit_tests/pyrefly.toml b/api/tests/unit_tests/pyrefly.toml
index ac608fef71b..285312e71a4 100644
--- a/api/tests/unit_tests/pyrefly.toml
+++ b/api/tests/unit_tests/pyrefly.toml
@@ -18,7 +18,6 @@ project-excludes = [
"commands/test_clean_expired_messages.py",
"commands/test_data_migration_commands.py",
"commands/test_data_migration_wizard.py",
- "commands/test_fix_app_site_missing.py",
"commands/test_generate_swagger_markdown_docs.py",
"commands/test_generate_swagger_specs.py",
"commands/test_lint_response_contracts.py",