Skip to content

Commit

Permalink
Create environment review on test execution start test
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-selo committed Oct 8, 2024
1 parent 5c03aa7 commit 26813da
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions backend/test_observer/controllers/test_executions/start_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from test_observer.data_access.models import (
Artefact,
ArtefactBuild,
ArtefactBuildEnvironmentReview,
Environment,
Stage,
TestExecution,
Expand Down Expand Up @@ -81,6 +82,15 @@ def start_test_execution(
},
)

get_or_create(
db,
ArtefactBuildEnvironmentReview,
filter_kwargs={
"environment_id": environment.id,
"artefact_build_id": artefact_build.id,
},
)

test_execution = get_or_create(
db,
TestExecution,
Expand Down
11 changes: 11 additions & 0 deletions backend/tests/controllers/test_executions/test_start_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from test_observer.data_access.models import (
Artefact,
ArtefactBuild,
ArtefactBuildEnvironmentReview,
Environment,
TestExecution,
TestResult,
Expand Down Expand Up @@ -99,6 +100,16 @@ def test_creates_all_data_models(db_session: Session, execute: Execute):
)
assert artefact_build

environment_review = (
db_session.query(ArtefactBuildEnvironmentReview)
.filter(
ArtefactBuildEnvironmentReview.artefact_build_id == artefact_build.id,
ArtefactBuildEnvironmentReview.environment_id == environment.id,
)
.one_or_none()
)
assert environment_review

test_execution = (
db_session.query(TestExecution)
.filter(
Expand Down

0 comments on commit 26813da

Please sign in to comment.