fix: resolve type errors and update tests to use CreateAppParams

This commit is contained in:
satishkc7 2026-05-08 00:17:48 -05:00
parent 39fb4d8800
commit 6f193a198f
6 changed files with 73 additions and 73 deletions

View File

@ -165,8 +165,8 @@ class AppService:
app = App(**app_template["app"])
app.name = params.name
app.description = params.description or ""
app.mode = params.mode
app.icon_type = params.icon_type or "emoji"
app.mode = app_mode
app.icon_type = IconType(params.icon_type) if params.icon_type else IconType.EMOJI
app.icon = params.icon
app.icon_background = params.icon_background
app.tenant_id = tenant_id

View File

@ -9,7 +9,7 @@ from models import Account
from models.enums import ConversationFromSource, InvokeFrom
from models.model import MessageAnnotation
from services.annotation_service import AppAnnotationService
from services.app_service import AppService
from services.app_service import AppService, CreateAppParams
from tests.test_containers_integration_tests.helpers import generate_valid_password
@ -86,16 +86,16 @@ class TestAnnotationService:
tenant = account.current_tenant
# Setup app creation arguments
app_args = {
"name": fake.company(),
"description": fake.text(max_nb_chars=100),
"mode": "chat",
"icon_type": "emoji",
"icon": "🤖",
"icon_background": "#FF6B6B",
"api_rph": 100,
"api_rpm": 10,
}
app_args = CreateAppParams(
name=fake.company(),
description=fake.text(max_nb_chars=100),
mode="chat",
icon_type="emoji",
icon="🤖",
icon_background="#FF6B6B",
api_rph=100,
api_rpm=10,
)
# Create app
app_service = AppService()

View File

@ -37,7 +37,7 @@ from services.app_dsl_service import (
PendingData,
_check_version_compatibility,
)
from services.app_service import AppService
from services.app_service import AppService, CreateAppParams
from tests.test_containers_integration_tests.helpers import generate_valid_password
_DEFAULT_TENANT_ID = "00000000-0000-0000-0000-000000000001"
@ -143,16 +143,16 @@ class TestAppDslService:
)
TenantService.create_owner_tenant_if_not_exist(account, name=fake.company())
tenant = account.current_tenant
app_args = {
"name": fake.company(),
"description": fake.text(max_nb_chars=100),
"mode": "chat",
"icon_type": "emoji",
"icon": "🤖",
"icon_background": "#FF6B6B",
"api_rph": 100,
"api_rpm": 10,
}
app_args = CreateAppParams(
name=fake.company(),
description=fake.text(max_nb_chars=100),
mode="chat",
icon_type="emoji",
icon="🤖",
icon_background="#FF6B6B",
api_rph=100,
api_rpm=10,
)
app_service = AppService()
app = app_service.create_app(tenant.id, app_args, account)
return app, account

View File

@ -82,6 +82,9 @@ class TestWorkflowAppService:
TenantService.create_owner_tenant_if_not_exist(account, name=fake.company())
tenant = account.current_tenant
# Import here to avoid circular dependency
from services.app_service import AppService, CreateAppParams
# Create app with realistic data
app_args = CreateAppParams(
name=fake.company(),
@ -94,9 +97,6 @@ class TestWorkflowAppService:
api_rpm=10,
)
# Import here to avoid circular dependency
from services.app_service import AppService, CreateAppParams
app_service = AppService()
app = app_service.create_app(tenant.id, app_args, account)
@ -146,6 +146,9 @@ class TestWorkflowAppService:
"""
fake = Faker()
# Import here to avoid circular dependency
from services.app_service import AppService, CreateAppParams
# Create app with realistic data
app_args = CreateAppParams(
name=fake.company(),
@ -158,9 +161,6 @@ class TestWorkflowAppService:
api_rpm=10,
)
# Import here to avoid circular dependency
from services.app_service import AppService, CreateAppParams
app_service = AppService()
app = app_service.create_app(tenant.id, app_args, account)

View File

@ -13,7 +13,7 @@ from models.model import (
)
from models.workflow import WorkflowRun
from services.account_service import AccountService, TenantService
from services.app_service import AppService
from services.app_service import AppService, CreateAppParams
from services.workflow_run_service import WorkflowRunService
from tests.test_containers_integration_tests.helpers import generate_valid_password
@ -79,16 +79,16 @@ class TestWorkflowRunService:
tenant = account.current_tenant
# Create app with realistic data
app_args = {
"name": fake.company(),
"description": fake.text(max_nb_chars=100),
"mode": "chat",
"icon_type": "emoji",
"icon": "🤖",
"icon_background": "#FF6B6B",
"api_rph": 100,
"api_rpm": 10,
}
app_args = CreateAppParams(
name=fake.company(),
description=fake.text(max_nb_chars=100),
mode="chat",
icon_type="emoji",
icon="🤖",
icon_background="#FF6B6B",
api_rph=100,
api_rpm=10,
)
app_service = AppService()
app = app_service.create_app(tenant.id, app_args, account)
@ -535,13 +535,13 @@ class TestWorkflowRunService:
tenant = account.current_tenant
# Create app
app_args = {
"name": "Test App",
"mode": "chat",
"icon_type": "emoji",
"icon": "🚀",
"icon_background": "#4ECDC4",
}
app_args = CreateAppParams(
name="Test App",
mode="chat",
icon_type="emoji",
icon="🚀",
icon_background="#4ECDC4",
)
app = app_service.create_app(tenant.id, app_args, account)
# Create workflow run without node executions
@ -586,13 +586,13 @@ class TestWorkflowRunService:
tenant = account.current_tenant
# Create app
app_args = {
"name": "Test App",
"mode": "chat",
"icon_type": "emoji",
"icon": "🚀",
"icon_background": "#4ECDC4",
}
app_args = CreateAppParams(
name="Test App",
mode="chat",
icon_type="emoji",
icon="🚀",
icon_background="#4ECDC4",
)
app = app_service.create_app(tenant.id, app_args, account)
# Use invalid workflow run ID
@ -637,13 +637,13 @@ class TestWorkflowRunService:
tenant = account.current_tenant
# Create app
app_args = {
"name": "Test App",
"mode": "chat",
"icon_type": "emoji",
"icon": "🚀",
"icon_background": "#4ECDC4",
}
app_args = CreateAppParams(
name="Test App",
mode="chat",
icon_type="emoji",
icon="🚀",
icon_background="#4ECDC4",
)
app = app_service.create_app(tenant.id, app_args, account)
# Create workflow run

View File

@ -11,7 +11,7 @@ from core.tools.errors import WorkflowToolHumanInputNotSupportedError
from models.tools import WorkflowToolProvider
from models.workflow import Workflow as WorkflowModel
from services.account_service import AccountService, TenantService
from services.app_service import AppService
from services.app_service import AppService, CreateAppParams
from services.tools.workflow_tools_manage_service import WorkflowToolManageService
from tests.test_containers_integration_tests.helpers import generate_valid_password
@ -94,16 +94,16 @@ class TestWorkflowToolManageService:
tenant = account.current_tenant
# Create app with realistic data
app_args = {
"name": fake.company(),
"description": fake.text(max_nb_chars=100),
"mode": "workflow",
"icon_type": "emoji",
"icon": "🤖",
"icon_background": "#FF6B6B",
"api_rph": 100,
"api_rpm": 10,
}
app_args = CreateAppParams(
name=fake.company(),
description=fake.text(max_nb_chars=100),
mode="workflow",
icon_type="emoji",
icon="🤖",
icon_background="#FF6B6B",
api_rph=100,
api_rpm=10,
)
app_service = AppService()
app = app_service.create_app(tenant.id, app_args, account)