Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions app/constants/shared_constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#
# Copyright (c) 2025 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from enum import Enum

"""
Shared constants across the application.
"""


class TestStateEnum(str, Enum):
__test__ = False # Needed to indicate to PyTest that this is not a "test"
PENDING = "pending"
EXECUTING = "executing"
PENDING_ACTUATION = "pending_actuation" # TODO: Do we need this
PASSED = "passed" # Test Passed with no issued
FAILED = "failed" # Test Failed
ERROR = "error" # Test Error due to tool setup or environment
NOT_APPLICABLE = "not_applicable" # Test is not applicable - e.g. PICS mismatch
CANCELLED = "cancelled"


# Enum Keys for different types of messages currently supported by the tool
class MessageTypeEnum(str, Enum):
PROMPT_REQUEST = "prompt_request"
PROMPT_RESPONSE = "prompt_response"
OPTIONS_REQUEST = "options_request"
MESSAGE_REQUEST = "message_request"
TEST_UPDATE = "test_update"
FILE_UPLOAD_REQUEST = "file_upload_request"
TIME_OUT_NOTIFICATION = "time_out_notification"
TEST_LOG_RECORDS = "test_log_records"
INVALID_MESSAGE = "invalid_message"
STREAM_VERIFICATION_REQUEST = "stream_verification_request"
IMAGE_VERIFICATION_REQUEST = "image_verification_request"
TWO_WAY_TALK_VERIFICATION_REQUEST = "two_way_talk_verification_request"
PUSH_AV_STREAM_VERIFICATION_REQUEST = "push_av_stream_verification_request"


# Enum keys used with messages at the top level
class MessageKeysEnum(str, Enum):
TYPE = "type"
PAYLOAD = "payload"


# Enum for DUT Pairing Modes
class DutPairingModeEnum(str, Enum):
ON_NETWORK = "onnetwork"
BLE_WIFI = "ble-wifi"
BLE_THREAD = "ble-thread"
WIFIPAF_WIFI = "wifipaf-wifi"
NFC_THREAD = "nfc-thread"
25 changes: 1 addition & 24 deletions app/constants/websockets_constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Project CHIP Authors
# Copyright (c) 2025 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,23 +27,6 @@
UDP_SOCKET_INTERFACE = "0.0.0.0"


# Enum Keys for different types of messages currently supported by the tool
class MessageTypeEnum(str, Enum):
PROMPT_REQUEST = "prompt_request"
OPTIONS_REQUEST = "options_request"
MESSAGE_REQUEST = "message_request"
FILE_UPLOAD_REQUEST = "file_upload_request"
PROMPT_RESPONSE = "prompt_response"
TEST_UPDATE = "test_update"
TIME_OUT_NOTIFICATION = "time_out_notification"
TEST_LOG_RECORDS = "test_log_records"
INVALID_MESSAGE = "invalid_message"
STREAM_VERIFICATION_REQUEST = "stream_verification_request"
IMAGE_VERIFICATION_REQUEST = "image_verification_request"
TWO_WAY_TALK_VERIFICATION_REQUEST = "two_way_talk_verification_request"
PUSH_AV_STREAM_VERIFICATION_REQUEST = "push_av_stream_verification_request"


class WebSocketTypeEnum(str, Enum):
MAIN = "main"
VIDEO = "video"
Expand All @@ -55,9 +38,3 @@ class WebSocketConnection:
def __init__(self, websocket: WebSocket, socket_type: WebSocketTypeEnum) -> None:
self.websocket = websocket
self.type = socket_type


# Enum keys used with messages at the top level
class MessageKeysEnum(str, Enum):
TYPE = "type"
PAYLOAD = "payload"
5 changes: 3 additions & 2 deletions app/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Project CHIP Authors
# Copyright (c) 2025 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -13,11 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from app.constants.shared_constants import TestStateEnum

from .operator import Operator
from .project import Project
from .test_case_execution import TestCaseExecution
from .test_case_metadata import TestCaseMetadata
from .test_enums import TestStateEnum
from .test_run_config import TestRunConfig
from .test_run_execution import TestRunExecution
from .test_step_execution import TestStepExecution
Expand Down
4 changes: 2 additions & 2 deletions app/models/test_case_execution.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Project CHIP Authors
# Copyright (c) 2025 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,7 @@

from app.db.base_class import Base

from .test_enums import TestStateEnum
from . import TestStateEnum

if TYPE_CHECKING:
from .test_case_metadata import TestCaseMetadata # noqa: F401
Expand Down
28 changes: 0 additions & 28 deletions app/models/test_enums.py

This file was deleted.

2 changes: 1 addition & 1 deletion app/models/test_run_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from app.db.base_class import Base
from app.db.pydantic_data_type import PydanticListType

from .test_enums import TestStateEnum
from . import TestStateEnum
from .test_suite_execution import TestSuiteExecution

if TYPE_CHECKING:
Expand Down
4 changes: 2 additions & 2 deletions app/models/test_step_execution.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Project CHIP Authors
# Copyright (c) 2025 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -21,7 +21,7 @@

from app.db.base_class import Base

from .test_enums import TestStateEnum
from . import TestStateEnum

if TYPE_CHECKING:
from .test_case_execution import TestCaseExecution # noqa: F401
Expand Down
4 changes: 2 additions & 2 deletions app/models/test_suite_execution.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Project CHIP Authors
# Copyright (c) 2025 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -23,8 +23,8 @@

from app.db.base_class import Base

from . import TestStateEnum
from .test_case_execution import TestCaseExecution
from .test_enums import TestStateEnum

if TYPE_CHECKING:
from .test_run_execution import TestRunExecution # noqa: F401
Expand Down
4 changes: 2 additions & 2 deletions app/schemas/grouped_test_run_execution_logs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Project CHIP Authors
# Copyright (c) 2025 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,7 @@

from pydantic import BaseModel

from app.models.test_enums import TestStateEnum
from app.models import TestStateEnum
from app.schemas.test_run_log_entry import TestRunLogEntry


Expand Down
4 changes: 2 additions & 2 deletions app/schemas/test_case_execution.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Project CHIP Authors
# Copyright (c) 2025 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,7 @@

from pydantic import BaseModel

from app.models.test_enums import TestStateEnum
from app.models import TestStateEnum

from .test_case_metadata import TestCaseMetadata, TestCaseMetadataBase
from .test_step_execution import TestStepExecution, TestStepExecutionToExport
Expand Down
4 changes: 2 additions & 2 deletions app/schemas/test_run_execution.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Project CHIP Authors
# Copyright (c) 2025 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,7 @@

from pydantic import BaseModel

from app.models.test_enums import TestStateEnum
from app.models import TestStateEnum

from .operator import Operator, OperatorToExport
from .test_run_config import TestRunConfigToExport
Expand Down
4 changes: 2 additions & 2 deletions app/schemas/test_step_execution.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Project CHIP Authors
# Copyright (c) 2025 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,7 @@

from pydantic import BaseModel

from app.models.test_enums import TestStateEnum
from app.models import TestStateEnum


# Shared properties
Expand Down
4 changes: 2 additions & 2 deletions app/schemas/test_suite_execution.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Project CHIP Authors
# Copyright (c) 2025 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,7 @@

from pydantic import BaseModel

from app.models.test_enums import TestStateEnum
from app.models import TestStateEnum

from .test_case_execution import TestCaseExecution, TestCaseExecutionToExport
from .test_suite_metadata import TestSuiteMetadata, TestSuiteMetadataBase
Expand Down
5 changes: 2 additions & 3 deletions app/socket_connection_manager.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Project CHIP Authors
# Copyright (c) 2025 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -26,14 +26,13 @@
from starlette.websockets import WebSocketState
from websockets.exceptions import ConnectionClosedOK

from app.constants.shared_constants import MessageKeysEnum, MessageTypeEnum
from app.constants.websockets_constants import (
INVALID_JSON_ERROR_STR,
MISSING_TYPE_ERROR_STR,
NO_HANDLER_FOR_MSG_ERROR_STR,
UDP_SOCKET_INTERFACE,
UDP_SOCKET_PORT,
MessageKeysEnum,
MessageTypeEnum,
WebSocketConnection,
WebSocketTypeEnum,
)
Expand Down
5 changes: 2 additions & 3 deletions app/test_engine/models/manual_test_case.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Project CHIP Authors
# Copyright (c) 2025 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -16,8 +16,7 @@
from enum import IntEnum
from typing import Optional

from app.models import TestCaseExecution
from app.models.test_enums import TestStateEnum
from app.models import TestCaseExecution, TestStateEnum
from app.test_engine.logger import test_engine_logger as logger
from app.user_prompt_support import (
OptionsSelectPromptRequest,
Expand Down
5 changes: 2 additions & 3 deletions app/test_engine/models/test_case.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Project CHIP Authors
# Copyright (c) 2025 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -16,8 +16,7 @@
from asyncio import CancelledError
from typing import Any, List, Union

from app.models import Project, TestCaseExecution
from app.models.test_enums import TestStateEnum
from app.models import Project, TestCaseExecution, TestStateEnum
from app.test_engine.logger import test_engine_logger as logger
from app.test_engine.models.utils import LogSeparator
from app.test_engine.test_observable import TestObservable
Expand Down
5 changes: 2 additions & 3 deletions app/test_engine/models/test_run.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Project CHIP Authors
# Copyright (c) 2025 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -16,8 +16,7 @@
from asyncio import CancelledError, Task, create_task
from typing import List, Optional

from app.models import Project, TestRunExecution
from app.models.test_enums import TestStateEnum
from app.models import Project, TestRunExecution, TestStateEnum
from app.schemas.test_run_log_entry import TestRunLogEntry
from app.test_engine.logger import test_engine_logger as logger
from app.test_engine.test_observable import TestObservable
Expand Down
4 changes: 2 additions & 2 deletions app/test_engine/models/test_step.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Project CHIP Authors
# Copyright (c) 2025 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,7 @@
#
from typing import List, Optional

from app.models.test_enums import TestStateEnum
from app.models import TestStateEnum
from app.models.test_step_execution import TestStepExecution
from app.test_engine.logger import test_engine_logger as logger
from app.test_engine.models.utils import LogSeparator
Expand Down
Loading