Skip to content

Commit

Permalink
updating tests to use utils fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
srh-sloan committed Jul 18, 2024
1 parent c698102 commit 57fe637
Show file tree
Hide file tree
Showing 6 changed files with 309 additions and 201 deletions.
3 changes: 2 additions & 1 deletion config/envs/unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ class UnitTestConfig(Config):
FSD_LOG_LEVEL = logging.DEBUG

SQLALCHEMY_DATABASE_URI = getenv(
"DATABASE_URL", "postgresql://postgres:[email protected]:5432/fab_unit_test" # pragma: allowlist secret
"DATABASE_URL_UNIT_TEST",
"postgresql://postgres:[email protected]:5432/fab_unit_test", # pragma: allowlist secret
)
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ services:
command: sleep infinity
environment:
- DATABASE_URL=postgresql://postgres:password@fab-db:5432/fab
- DATABASE_URL_UNIT_TEST=postgresql://postgres:password@fab-db:5432/fab_unit_test


fab-db:
Expand Down
124 changes: 62 additions & 62 deletions tasks/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,30 +101,30 @@ def init_data() -> dict:
name_in_apply_json={"en": "Organisation Classification"},
form_index=4,
)
p4: Page = Page(
page_id=uuid4(),
form_id=None,
display_path="organisation-alternative-names",
name_in_apply_json={"en": "Alternative names of your organisation"},
form_index=2,
is_template=True,
)
template_page: Page = Page(
page_id=uuid4(),
form_id=None,
display_path="testing_templates_path",
is_template=True,
name_in_apply_json={"en": "Template Path"},
form_index=0,
)
non_template_page: Page = Page(
page_id=uuid4(),
form_id=None,
display_path="testing_templates_path",
is_template=False,
name_in_apply_json={"en": "Not Template Path"},
form_index=0,
)
# p_org_alt_names: Page = Page(
# page_id=uuid4(),
# form_id=None,
# display_path="organisation-alternative-names",
# name_in_apply_json={"en": "Alternative names of your organisation"},
# form_index=2,
# is_template=True,
# )
# template_page: Page = Page(
# page_id=uuid4(),
# form_id=None,
# display_path="testing_templates_path",
# is_template=True,
# name_in_apply_json={"en": "Template Path"},
# form_index=0,
# )
# non_template_page: Page = Page(
# page_id=uuid4(),
# form_id=None,
# display_path="testing_templates_path",
# is_template=False,
# name_in_apply_json={"en": "Not Template Path"},
# form_index=0,
# )
cri1: Criteria = Criteria(criteria_id=uuid4(), index=1, round_id=r.round_id, name="Unscored", weighting=0.0)
sc1: Subcriteria = Subcriteria(
subcriteria_id=uuid4(), criteria_index=1, criteria_id=cri1.criteria_id, name="Organisation Information"
Expand Down Expand Up @@ -178,31 +178,31 @@ def init_data() -> dict:
options={"hideTitle": False, "classes": ""},
runner_component_name="organisation_name",
)
c3: Component = Component(
component_id=uuid4(),
page_id=p1.page_id,
title="Does your organisation use any other names?",
type=ComponentType.YES_NO_FIELD,
page_index=2,
theme_id=t1.theme_id,
theme_index=2,
options={"hideTitle": False, "classes": ""},
runner_component_name="does_your_organisation_use_other_names",
conditions=[
{
"name": "organisation_other_names_no",
"value": "false", # this must be lowercaes or the navigation doesn't work
"operator": "is",
"destination_page_path": "CONTINUE",
},
{
"name": "organisation_other_names_yes",
"value": "true", # this must be lowercaes or the navigation doesn't work
"operator": "is",
"destination_page_path": "organisation-alternative-names",
},
],
)
# c3: Component = Component(
# component_id=uuid4(),
# page_id=p1.page_id,
# title="Does your organisation use any other names?",
# type=ComponentType.YES_NO_FIELD,
# page_index=2,
# theme_id=t1.theme_id,
# theme_index=2,
# options={"hideTitle": False, "classes": ""},
# runner_component_name="does_your_organisation_use_other_names",
# conditions=[
# {
# "name": "organisation_other_names_no",
# "value": "false", # this must be lowercaes or the navigation doesn't work
# "operator": "is",
# "destination_page_path": "CONTINUE",
# },
# {
# "name": "organisation_other_names_yes",
# "value": "true", # this must be lowercaes or the navigation doesn't work
# "operator": "is",
# "destination_page_path": "organisation-alternative-names",
# },
# ],
# )
c2: Component = Component(
component_id=uuid4(),
page_id=p2.page_id,
Expand All @@ -215,17 +215,17 @@ def init_data() -> dict:
options={"hideTitle": False, "classes": ""},
runner_component_name="organisation_address",
)
c7: Component = Component(
component_id=uuid4(),
page_id=p4.page_id,
title="Alternative Name 1",
type=ComponentType.TEXT_FIELD,
page_index=1,
theme_id=None,
theme_index=None,
options={"hideTitle": False, "classes": ""},
runner_component_name="alt_name_1",
)
# c7: Component = Component(
# component_id=uuid4(),
# page_id=p_org_alt_names.page_id,
# title="Alternative Name 1",
# type=ComponentType.TEXT_FIELD,
# page_index=1,
# theme_id=None,
# theme_index=None,
# options={"hideTitle": False, "classes": ""},
# runner_component_name="alt_name_1",
# )
l1: Lizt = Lizt(
list_id=uuid4(),
name="classifications_list",
Expand All @@ -251,8 +251,8 @@ def init_data() -> dict:
"rounds": [r, r2],
"sections": [s1],
"forms": [f1, f2],
"pages": [p1, p2, p3, template_page, non_template_page, p4, p5],
"components": [c1, c2, c3, c4, c5, c6, c7, c8],
"pages": [p1, p2, p3, p5], # template_page, non_template_page, p_org_alt_names
"components": [c1, c2, c4, c5, c6, c8], # c3,c7
"criteria": [cri1],
"subcriteria": [sc1],
"themes": [t1, t2],
Expand Down
Loading

0 comments on commit 57fe637

Please sign in to comment.