Skip to content

Commit

Permalink
Check user prompt answer FAILED for DUT commissioning (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
rquidute authored and hiltonlima committed Oct 24, 2024
1 parent 8daf046 commit 6061a1b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
)

from ...sdk_container import SDKContainer
from ...utils import prompt_for_commissioning_mode
from .utils import commission_device
from ...utils import PromptOption, prompt_for_commissioning_mode
from .utils import DUTCommissioningError, commission_device


class SuiteType(Enum):
Expand Down Expand Up @@ -124,7 +124,14 @@ class CommissioningPythonTestSuite(PythonTestSuite, UserPromptSupport):
async def setup(self) -> None:
await super().setup()

await prompt_for_commissioning_mode(self, logger, None, self.cancel)
user_response = await prompt_for_commissioning_mode(
self, logger, None, self.cancel
)

if user_response == PromptOption.FAIL:
raise DUTCommissioningError(
"User chose prompt option FAILED for DUT is in Commissioning Mode"
)

logger.info("Commission DUT")

Expand Down
3 changes: 2 additions & 1 deletion test_collections/matter/sdk_tests/support/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async def prompt_for_commissioning_mode(
logger: loguru.Logger,
on_success: Optional[Callable] = None,
on_failure: Optional[Callable] = None,
) -> None:
) -> PromptOption:
prompt = "Make sure the DUT is in Commissioning Mode"
options = {
"DONE": PromptOption.PASS,
Expand All @@ -62,3 +62,4 @@ async def prompt_for_commissioning_mode(
f"Received unknown prompt option for \
commissioning step: {prompt_response.response}"
)
return prompt_response.response

0 comments on commit 6061a1b

Please sign in to comment.