Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Updating WebSocket Schema and Methods #6

Draft
wants to merge 1 commit into
base: v1.3-TE1
Choose a base branch
from
Draft
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
6 changes: 3 additions & 3 deletions app/test_run/socket_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ class TestRunUpdate(TestUpdateBase):


class TestSuiteUpdate(TestUpdateBase):
test_suite_execution_id: int
test_suite_execution_index: int


class TestCaseUpdate(TestSuiteUpdate):
test_case_execution_id: int
test_case_execution_index: int


class TestStepUpdate(TestCaseUpdate):
test_step_execution_id: int
test_step_execution_index: int


class TestUpdate(BaseModel):
Expand Down
26 changes: 13 additions & 13 deletions app/test_run/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,20 @@ def __log_test_run_update(self, update: TestRunUpdate) -> None:
click.echo(f"Test Run [{str(update.state.name)}]")

def __log_test_suite_update(self, update: TestSuiteUpdate) -> None:
suite = self.__suite(update.test_suite_execution_id)
suite = self.__suite(update.test_suite_execution_index)
title = suite.test_suite_metadata.title
click.echo(f" - {title} [{str(update.state.name)}]")

def __log_test_case_update(self, update: TestCaseUpdate) -> None:
case = self.__case(id=update.test_case_execution_id, suite_id=update.test_suite_execution_id)
case = self.__case(index=update.test_case_execution_index, suite_index=update.test_suite_execution_index)
title = case.test_case_metadata.title
click.echo(f" - {title} [{str(update.state.name)}]")

def __log_test_step_update(self, update: TestStepUpdate) -> None:
step = self.__step(
id=update.test_step_execution_id,
case_id=update.test_case_execution_id,
suite_id=update.test_suite_execution_id,
index=update.test_step_execution_index,
case_index=update.test_case_execution_index,
suite_index=update.test_suite_execution_index,
)
if step is not None:
title = step.title
Expand All @@ -127,13 +127,13 @@ def __handle_log_record(self, records: List[TestLogRecord]) -> None:
for record in records:
logger.log(record.level, record.message)

def __suite(self, id: int) -> TestSuiteExecution:
return next((s for s in self.run.test_suite_executions if s.id == id))
def __suite(self, index: int) -> TestSuiteExecution:
return self.run.test_suite_executions[index]

def __case(self, id: int, suite_id: int) -> TestCaseExecution:
suite = self.__suite(suite_id)
return next((c for c in suite.test_case_executions if c.id == id))
def __case(self, index: int, suite_index: int) -> TestCaseExecution:
suite = self.__suite(index=suite_index)
return suite.test_case_executions[index]

def __step(self, id: int, case_id: int, suite_id: int) -> Optional[TestStepExecution]:
case = self.__case(id=case_id, suite_id=suite_id)
return next((s for s in case.test_step_executions if s.id == id), None)
def __step(self, index: int, case_index: int, suite_index: int) -> Optional[TestStepExecution]:
case = self.__case(index=case_index, suite_index=suite_index)
return case.test_step_executions[index]