Skip to content

Commit 8cc3383

Browse files
Refactoring for duplicate code
1 parent 2b470d3 commit 8cc3383

File tree

1 file changed

+15
-24
lines changed
  • tests/regression/subject/episodes/datasets/investigation/endoscopy/polypcategories

1 file changed

+15
-24
lines changed

tests/regression/subject/episodes/datasets/investigation/endoscopy/polypcategories/test_setup.py

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,12 @@
6363
from utils.user_tools import UserTools
6464

6565

66-
def test_setup_subjects_as_a99(
67-
page: Page, subjects_to_run_for: int, request: FixtureRequest
68-
) -> None:
66+
@pytest.fixture(scope="function", autouse=True)
67+
def before_each(page: Page, request: FixtureRequest) -> None:
6968
"""
70-
Scenario Outline: Set up 10 subjects to be at status A99
69+
Checks that the required organization parameters are set correctly before each test.
70+
If not, it sets them to the expected values.
71+
Also sets up appointments if the test has not been run today.
7172
"""
7273
param_12_set_correctly = check_parameter(12, "23162", "10")
7374
param_28_set_correctly = check_parameter(28, "23162", "07:00")
@@ -84,9 +85,15 @@ def test_setup_subjects_as_a99(
8485
"subject/episodes/datasets/investigation/endoscopy/polypcategories/test_setup", base_url # type: ignore
8586
):
8687
setup_appointments(page)
87-
page = page.context.new_page()
88-
page.goto("/")
8988

89+
90+
@pytest.mark.wip
91+
def test_setup_subjects_as_a99(page: Page, subjects_to_run_for: int) -> None:
92+
"""
93+
Scenario Outline: Set up 10 subjects to be at status A99
94+
"""
95+
page = page.context.new_page()
96+
page.goto("/")
9097
criteria = {
9198
"latest event status": "S9",
9299
"latest episode type": "FOBT",
@@ -116,24 +123,8 @@ def test_setup_subjects_as_a259(
116123
"""
117124
Set up 10 subjects to have new Colonoscopy datasets in episodes started within in the last 4 years
118125
"""
119-
param_12_set_correctly = check_parameter(12, "23162", "10")
120-
param_28_set_correctly = check_parameter(28, "23162", "07:00")
121-
param_29_set_correctly = check_parameter(29, "23162", "20:00")
122-
if not param_12_set_correctly:
123-
set_org_parameter_value(12, "10", "23162")
124-
if not param_28_set_correctly:
125-
set_org_parameter_value(28, "07:00", "23162")
126-
if not param_29_set_correctly:
127-
set_org_parameter_value(29, "20:00", "23162")
128-
129-
base_url = request.config.getoption("--base-url")
130-
if not has_test_run_today(
131-
"subject/episodes/datasets/investigation/endoscopy/polypcategories/test_setup", base_url # type: ignore
132-
):
133-
setup_appointments(page)
134-
page = page.context.new_page()
135-
page.goto("/")
136-
126+
page = page.context.new_page()
127+
page.goto("/")
137128
criteria = {
138129
"latest episode status": "open",
139130
"latest episode latest investigation dataset": "colonoscopy_new",

0 commit comments

Comments
 (0)