Skip to content

Commit

Permalink
Merge duplicate test_execution fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-selo committed May 7, 2024
1 parent c2e22f6 commit 2c426f6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
10 changes: 10 additions & 0 deletions backend/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
drop_database,
)

from test_observer.data_access.models import TestExecution
from test_observer.data_access.setup import get_db
from test_observer.main import app
from tests.data_generator import DataGenerator
Expand Down Expand Up @@ -94,3 +95,12 @@ def test_client(db_session: Session) -> TestClient:
@pytest.fixture
def generator(db_session: Session) -> DataGenerator:
return DataGenerator(db_session)


@pytest.fixture
def test_execution(generator: DataGenerator) -> TestExecution:
a = generator.gen_artefact("beta")
ab = generator.gen_artefact_build(a)
e = generator.gen_environment()
te = generator.gen_test_execution(ab, e)
return te
12 changes: 0 additions & 12 deletions backend/tests/controllers/test_executions/test_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

import pytest
from fastapi.testclient import TestClient

from test_observer.data_access.models import (
Expand All @@ -24,17 +23,6 @@
TestExecutionReviewDecision,
TestExecutionStatus,
)
from tests.data_generator import DataGenerator


@pytest.fixture
def test_execution(generator: DataGenerator) -> TestExecution:
a = generator.gen_artefact("beta")
ab = generator.gen_artefact_build(a)
e = generator.gen_environment()
te = generator.gen_test_execution(ab, e, ci_link="http://cilink")

return te


def test_updates_test_execution(test_client: TestClient, test_execution: TestExecution):
Expand Down
9 changes: 0 additions & 9 deletions backend/tests/controllers/test_executions/test_reruns.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,6 @@
reruns_url = "/v1/test-executions/reruns"


@pytest.fixture
def test_execution(generator: DataGenerator) -> TestExecution:
a = generator.gen_artefact("beta")
ab = generator.gen_artefact_build(a)
e = generator.gen_environment()
te = generator.gen_test_execution(ab, e)
return te


@pytest.fixture
def post(test_client: TestClient):
def post_helper(data: Any) -> Response: # noqa: ANN401
Expand Down

0 comments on commit 2c426f6

Please sign in to comment.