+
diff --git a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ordnance.j2 b/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_ordnance.j2
similarity index 81%
rename from vasl_templates/webapp/tests/fixtures/data/default-template-pack/ordnance.j2
rename to vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_ordnance.j2
index 5ae9e0e..1d59af9 100644
--- a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ordnance.j2
+++ b/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_ordnance.j2
@@ -1,4 +1,4 @@
-[{{PLAYER_NAME}}] ; width={{ORDNANCE_WIDTH}}{%for ord in ORDNANCE %}
+[{{PLAYER_NAME}}] ; width={{OB_ORDNANCE_WIDTH}}{%for ord in OB_ORDNANCE %}
[*] {{ord.name}}: #={{ord.note_number}}{%if ord.notes%}
- notes:{%for n in ord.notes%} "{{n}}"{%endfor%}{%endif%}{%if ord.capabilities%}
- capabilities:{%for c in ord.capabilities%} "{{c}}"{%endfor%}{%endif%}{%if ord.raw_capabilities%}
diff --git a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/vehicles.j2 b/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_vehicles.j2
similarity index 83%
rename from vasl_templates/webapp/tests/fixtures/data/default-template-pack/vehicles.j2
rename to vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_vehicles.j2
index 5196be9..60ca469 100644
--- a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/vehicles.j2
+++ b/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_vehicles.j2
@@ -1,4 +1,4 @@
-[{{PLAYER_NAME}}] ; width={{VEHICLES_WIDTH}}{%for veh in VEHICLES %}
+[{{PLAYER_NAME}}] ; width={{OB_VEHICLES_WIDTH}}{%for veh in OB_VEHICLES %}
[*] {{veh.name}}: #={{veh.note_number}}{%if veh.notes%}
- notes:{%for n in veh.notes%} "{{n}}"{%endfor%}{%endif%}{%if veh.crew_survival%}
- {{veh.crew_survival}}{%endif%}{%if veh.capabilities%}
diff --git a/vasl_templates/webapp/tests/fixtures/new-default-scenario.json b/vasl_templates/webapp/tests/fixtures/new-default-scenario.json
index 6342bbf..e52bf61 100644
--- a/vasl_templates/webapp/tests/fixtures/new-default-scenario.json
+++ b/vasl_templates/webapp/tests/fixtures/new-default-scenario.json
@@ -37,10 +37,10 @@
{ "caption": "default american OB note #1", "width": "103px" },
{ "caption": "default american OB note #2", "width": "104px" }
],
-"VEHICLES_1": [],
-"VEHICLES_WIDTH_1": "110px",
-"ORDNANCE_1": [],
-"ORDNANCE_WIDTH_1": "120px",
+"OB_VEHICLES_1": [],
+"OB_VEHICLES_WIDTH_1": "110px",
+"OB_ORDNANCE_1": [],
+"OB_ORDNANCE_WIDTH_1": "120px",
"OB_SETUPS_2": [
{ "caption": "default japanese OB setup #1", "width": "201px" },
@@ -50,10 +50,10 @@
{ "caption": "default japanese OB note #1", "width": "203px" },
{ "caption": "default japanese OB note #2", "width": "204px" }
],
-"VEHICLES_2": [],
-"VEHICLES_WIDTH_2": "210px",
-"ORDNANCE_2": [],
-"ORDNANCE_WIDTH_2": "211px",
+"OB_VEHICLES_2": [],
+"OB_VEHICLES_WIDTH_2": "210px",
+"OB_ORDNANCE_2": [],
+"OB_ORDNANCE_WIDTH_2": "211px",
"_OB_SETUP_WIDTH": "900px",
"_OB_NOTE_WIDTH": "901px"
diff --git a/vasl_templates/webapp/tests/fixtures/template-packs/full/ob_ordnance.j2 b/vasl_templates/webapp/tests/fixtures/template-packs/full/ob_ordnance.j2
new file mode 100644
index 0000000..58360cc
--- /dev/null
+++ b/vasl_templates/webapp/tests/fixtures/template-packs/full/ob_ordnance.j2
@@ -0,0 +1 @@
+Customized OB_ORDNANCE.
diff --git a/vasl_templates/webapp/tests/fixtures/template-packs/full/ob_vehicles.j2 b/vasl_templates/webapp/tests/fixtures/template-packs/full/ob_vehicles.j2
new file mode 100644
index 0000000..2f1fe1f
--- /dev/null
+++ b/vasl_templates/webapp/tests/fixtures/template-packs/full/ob_vehicles.j2
@@ -0,0 +1 @@
+Customized OB_VEHICLES.
diff --git a/vasl_templates/webapp/tests/fixtures/template-packs/full/ordnance.j2 b/vasl_templates/webapp/tests/fixtures/template-packs/full/ordnance.j2
deleted file mode 100644
index 803513e..0000000
--- a/vasl_templates/webapp/tests/fixtures/template-packs/full/ordnance.j2
+++ /dev/null
@@ -1 +0,0 @@
-Customized ORDNANCE.
diff --git a/vasl_templates/webapp/tests/fixtures/template-packs/full/vehicles.j2 b/vasl_templates/webapp/tests/fixtures/template-packs/full/vehicles.j2
deleted file mode 100644
index fd6e5e1..0000000
--- a/vasl_templates/webapp/tests/fixtures/template-packs/full/vehicles.j2
+++ /dev/null
@@ -1 +0,0 @@
-Customized VEHICLES.
diff --git a/vasl_templates/webapp/tests/fixtures/template-packs/new-default/ob_ordnance.j2 b/vasl_templates/webapp/tests/fixtures/template-packs/new-default/ob_ordnance.j2
new file mode 100644
index 0000000..072cce6
--- /dev/null
+++ b/vasl_templates/webapp/tests/fixtures/template-packs/new-default/ob_ordnance.j2
@@ -0,0 +1 @@
+New default OB_ORDNANCE.
diff --git a/vasl_templates/webapp/tests/fixtures/template-packs/new-default/ob_vehicles.j2 b/vasl_templates/webapp/tests/fixtures/template-packs/new-default/ob_vehicles.j2
new file mode 100644
index 0000000..86b10b5
--- /dev/null
+++ b/vasl_templates/webapp/tests/fixtures/template-packs/new-default/ob_vehicles.j2
@@ -0,0 +1 @@
+New default OB_VEHICLES.
diff --git a/vasl_templates/webapp/tests/fixtures/template-packs/new-default/ordnance.j2 b/vasl_templates/webapp/tests/fixtures/template-packs/new-default/ordnance.j2
deleted file mode 100644
index 7610438..0000000
--- a/vasl_templates/webapp/tests/fixtures/template-packs/new-default/ordnance.j2
+++ /dev/null
@@ -1 +0,0 @@
-New default ORDNANCE.
diff --git a/vasl_templates/webapp/tests/fixtures/template-packs/new-default/vehicles.j2 b/vasl_templates/webapp/tests/fixtures/template-packs/new-default/vehicles.j2
deleted file mode 100644
index 8012126..0000000
--- a/vasl_templates/webapp/tests/fixtures/template-packs/new-default/vehicles.j2
+++ /dev/null
@@ -1 +0,0 @@
-New default VEHICLES.
diff --git a/vasl_templates/webapp/tests/test_default_scenario.py b/vasl_templates/webapp/tests/test_default_scenario.py
index 8389271..5a79f4a 100644
--- a/vasl_templates/webapp/tests/test_default_scenario.py
+++ b/vasl_templates/webapp/tests/test_default_scenario.py
@@ -77,10 +77,10 @@ def test_default_scenario( webapp, webdriver, monkeypatch ):
# nb: should check the snippet widths as well (not really important for a default scenario)
# check the vehicles/ordnance (player 1)
- assert get_sortable_entry_text( find_child( "#vehicles-sortable_1" ) ) == []
- check_textbox( "VEHICLES_WIDTH_1", "110px" )
- assert get_sortable_entry_text( find_child( "#ordnance-sortable_1" ) ) == []
- check_textbox( "ORDNANCE_WIDTH_1", "120px" )
+ assert get_sortable_entry_text( find_child( "#ob_vehicles-sortable_1" ) ) == []
+ check_textbox( "OB_VEHICLES_WIDTH_1", "110px" )
+ assert get_sortable_entry_text( find_child( "#ob_ordnance-sortable_1" ) ) == []
+ check_textbox( "OB_ORDNANCE_WIDTH_1", "120px" )
select_tab( "ob2" )
@@ -92,10 +92,10 @@ def test_default_scenario( webapp, webdriver, monkeypatch ):
# nb: should check the snippet widths as well (not really important for a default scenario)
# check the vehicles/ordnance (player 2)
- assert get_sortable_entry_text( find_child( "#vehicles-sortable_2" ) ) == []
- check_textbox( "VEHICLES_WIDTH_2", "210px" )
- assert get_sortable_entry_text( find_child( "#ordnance-sortable_2" ) ) == []
- check_textbox( "ORDNANCE_WIDTH_2", "211px" )
+ assert get_sortable_entry_text( find_child( "#ob_vehicles-sortable_2" ) ) == []
+ check_textbox( "OB_VEHICLES_WIDTH_2", "210px" )
+ assert get_sortable_entry_text( find_child( "#ob_ordnance-sortable_2" ) ) == []
+ check_textbox( "OB_ORDNANCE_WIDTH_2", "211px" )
# check that the default OB setup/note width is being used
elem = find_child( "#ob_setups-add_2" )
diff --git a/vasl_templates/webapp/tests/test_dirty_scenario_checks.py b/vasl_templates/webapp/tests/test_dirty_scenario_checks.py
index d8cd9cc..a1dfaee 100644
--- a/vasl_templates/webapp/tests/test_dirty_scenario_checks.py
+++ b/vasl_templates/webapp/tests/test_dirty_scenario_checks.py
@@ -30,10 +30,10 @@ def test_dirty_scenario_checks( webapp, webdriver ):
"OB_NOTES_2": "#ob_notes-sortable_2",
}
VEHICLE_ORDNANCE = {
- "VEHICLES_1": ( "#vehicles-sortable_1", 1, "a german vehicle" ),
- "ORDNANCE_1": ( "#ordnance-sortable_1", 1, "a german ordnance" ),
- "VEHICLES_2": ( "#vehicles-sortable_2", 2, "a russian vehicle" ),
- "ORDNANCE_2": ( "#ordnance-sortable_2", 2, "a russian ordnance" ),
+ "OB_VEHICLES_1": ( "#ob_vehicles-sortable_1", 1, "a german vehicle" ),
+ "OB_ORDNANCE_1": ( "#ob_ordnance-sortable_1", 1, "a german ordnance" ),
+ "OB_VEHICLES_2": ( "#ob_vehicles-sortable_2", 2, "a russian vehicle" ),
+ "OB_ORDNANCE_2": ( "#ob_ordnance-sortable_2", 2, "a russian ordnance" ),
}
def change_field( param ):
diff --git a/vasl_templates/webapp/tests/test_players.py b/vasl_templates/webapp/tests/test_players.py
index ef20953..2256069 100644
--- a/vasl_templates/webapp/tests/test_players.py
+++ b/vasl_templates/webapp/tests/test_players.py
@@ -33,8 +33,8 @@ def test_player_change( webapp, webdriver ):
# check that we can change the player nationalities without being asked to confirm
# nb: the frontend ignores the vehicle/ordnance snippet widths when deciding if to ask for confirmation
VO_WIDTHS = {
- "ob1": { "VEHICLES_WIDTH_1": 123 },
- "ob2": { "ORDNANCE_WIDTH_2": 456 },
+ "ob1": { "OB_VEHICLES_WIDTH_1": 123 },
+ "ob2": { "OB_ORDNANCE_WIDTH_2": 456 },
}
load_scenario_params( VO_WIDTHS )
select_tab( "scenario" )
@@ -49,7 +49,7 @@ def test_player_change( webapp, webdriver ):
"OB_SETUPS_1": [ { "caption": "an ob setup", "width": "" } ],
},
"ob2": {
- "VEHICLES_2": [ "a german vehicle" ],
+ "OB_VEHICLES_2": [ "a german vehicle" ],
},
}
load_scenario_params( SCENARIO_PARAMS )
@@ -58,7 +58,7 @@ def test_player_change( webapp, webdriver ):
"""Get the contents of the player's OB tab."""
sortables = [
find_child( "#{}-sortable_{}".format( key, player_no ) )
- for key in ["ob_setups","ob_notes","vehicles","ordnance"]
+ for key in ["ob_setups","ob_notes","ob_vehicles","ob_ordnance"]
]
return [ get_sortable_entry_count(s) for s in sortables ]
diff --git a/vasl_templates/webapp/tests/test_scenario_persistence.py b/vasl_templates/webapp/tests/test_scenario_persistence.py
index 137da6d..bbe3aaf 100644
--- a/vasl_templates/webapp/tests/test_scenario_persistence.py
+++ b/vasl_templates/webapp/tests/test_scenario_persistence.py
@@ -23,13 +23,13 @@ ALL_SCENARIO_PARAMS = {
],
"ob1": [
"OB_SETUPS_1", "OB_NOTES_1",
- "VEHICLES_1", "VEHICLES_WIDTH_1",
- "ORDNANCE_1", "ORDNANCE_WIDTH_1",
+ "OB_VEHICLES_1", "OB_VEHICLES_WIDTH_1",
+ "OB_ORDNANCE_1", "OB_ORDNANCE_WIDTH_1",
],
"ob2": [
"OB_SETUPS_2", "OB_NOTES_2",
- "VEHICLES_2", "VEHICLES_WIDTH_2",
- "ORDNANCE_2", "ORDNANCE_WIDTH_2",
+ "OB_VEHICLES_2", "OB_VEHICLES_WIDTH_2",
+ "OB_ORDNANCE_2", "OB_ORDNANCE_WIDTH_2",
],
}
@@ -84,18 +84,18 @@ def test_scenario_persistence( webapp, webdriver ): #pylint: disable=too-many-st
{ "caption": "ob note 1a", "width": "10em" },
{ "caption": "ob note 1b", "width": "" }
],
- "VEHICLES_1": [ "a russian vehicle", "another russian vehicle" ],
- "VEHICLES_WIDTH_1": "202",
- "ORDNANCE_1": [ "a russian ordnance", "another russian ordnance" ],
- "ORDNANCE_WIDTH_1": "203",
+ "OB_VEHICLES_1": [ "a russian vehicle", "another russian vehicle" ],
+ "OB_VEHICLES_WIDTH_1": "202",
+ "OB_ORDNANCE_1": [ "a russian ordnance", "another russian ordnance" ],
+ "OB_ORDNANCE_WIDTH_1": "203",
},
"ob2": {
"OB_SETUPS_2": [ { "caption": "ob setup 2", "width": "" } ],
"OB_NOTES_2": [ { "caption": "ob note 2", "width": "" } ],
- "VEHICLES_2": [ "a german vehicle" ],
- "VEHICLES_WIDTH_2": "302",
- "ORDNANCE_2": [ "a german ordnance" ],
- "ORDNANCE_WIDTH_2": "303",
+ "OB_VEHICLES_2": [ "a german vehicle" ],
+ "OB_VEHICLES_WIDTH_2": "302",
+ "OB_ORDNANCE_2": [ "a german ordnance" ],
+ "OB_ORDNANCE_WIDTH_2": "303",
},
}
load_scenario_params( SCENARIO_PARAMS )
@@ -139,8 +139,8 @@ def test_scenario_persistence( webapp, webdriver ): #pylint: disable=too-many-st
ssrs = find_child( "#ssr-sortable" )
ob_setups1, ob_notes1 = find_child("#ob_setups-sortable_1"), find_child("#ob_notes-sortable_1")
ob_setups2, ob_notes2 = find_child("#ob_setups-sortable_2"), find_child("#ob_notes-sortable_2")
- vehicles1, ordnance1 = find_child("#vehicles-sortable_1"), find_child("#ordnance-sortable_1")
- vehicles2, ordnance2 = find_child("#vehicles-sortable_2"), find_child("#ordnance-sortable_2")
+ vehicles1, ordnance1 = find_child("#ob_vehicles-sortable_1"), find_child("#ob_ordnance-sortable_1")
+ vehicles2, ordnance2 = find_child("#ob_vehicles-sortable_2"), find_child("#ob_ordnance-sortable_2")
elems = {
c.get_attribute("name"): c
for elem_type in ("input","textarea","select") for c in find_children(elem_type)
@@ -158,7 +158,7 @@ def test_scenario_persistence( webapp, webdriver ): #pylint: disable=too-many-st
continue # nb: these require special handling, we do it below
if field in ("OB_SETUPS_1","OB_SETUPS_2","OB_NOTES_1","OB_NOTES_2"):
continue # nb: these require special handling, we do it below
- if field in ("VEHICLES_1","ORDNANCE_1","VEHICLES_2","ORDNANCE_2"):
+ if field in ("OB_VEHICLES_1","OB_ORDNANCE_1","OB_VEHICLES_2","OB_ORDNANCE_2"):
continue # nb: these require special handling, we do it below
elem = elems[ field ]
if elem.tag_name == "select":
@@ -172,13 +172,13 @@ def test_scenario_persistence( webapp, webdriver ): #pylint: disable=too-many-st
select_tab( "ob1" )
assert get_sortable_entry_text(ob_setups1) == [ obs["caption"] for obs in SCENARIO_PARAMS["ob1"]["OB_SETUPS_1"] ]
assert get_sortable_entry_text(ob_notes1) == [ obs["caption"] for obs in SCENARIO_PARAMS["ob1"]["OB_NOTES_1"] ]
- assert get_sortable_entry_text(vehicles1) == SCENARIO_PARAMS["ob1"]["VEHICLES_1"]
- assert get_sortable_entry_text(ordnance1) == SCENARIO_PARAMS["ob1"]["ORDNANCE_1"]
+ assert get_sortable_entry_text(vehicles1) == SCENARIO_PARAMS["ob1"]["OB_VEHICLES_1"]
+ assert get_sortable_entry_text(ordnance1) == SCENARIO_PARAMS["ob1"]["OB_ORDNANCE_1"]
select_tab( "ob2" )
assert get_sortable_entry_text(ob_setups2) == [ obs["caption"] for obs in SCENARIO_PARAMS["ob2"]["OB_SETUPS_2"] ]
assert get_sortable_entry_text(ob_notes2) == [ obs["caption"] for obs in SCENARIO_PARAMS["ob2"]["OB_NOTES_2"] ]
- assert get_sortable_entry_text(vehicles2) == SCENARIO_PARAMS["ob2"]["VEHICLES_2"]
- assert get_sortable_entry_text(ordnance2) == SCENARIO_PARAMS["ob2"]["ORDNANCE_2"]
+ assert get_sortable_entry_text(vehicles2) == SCENARIO_PARAMS["ob2"]["OB_VEHICLES_2"]
+ assert get_sortable_entry_text(ordnance2) == SCENARIO_PARAMS["ob2"]["OB_ORDNANCE_2"]
# ---------------------------------------------------------------------
@@ -219,11 +219,11 @@ def test_unknown_vo( webapp, webdriver ):
# load a scenario that has unknown vehicles/ordnance
SCENARIO_PARAMS = {
"PLAYER_1": "german",
- "VEHICLES_1": [ "unknown vehicle 1a", "unknown vehicle 1b" ],
- "ORDNANCE_1": [ "unknown ordnance 1a", "unknown ordnance 1b" ],
+ "OB_VEHICLES_1": [ "unknown vehicle 1a", "unknown vehicle 1b" ],
+ "OB_ORDNANCE_1": [ "unknown ordnance 1a", "unknown ordnance 1b" ],
"PLAYER_2": "russian",
- "VEHICLES_2": [ "unknown vehicle 2" ],
- "ORDNANCE_2": [ "unknown ordnance 2" ],
+ "OB_VEHICLES_2": [ "unknown vehicle 2" ],
+ "OB_ORDNANCE_2": [ "unknown ordnance 2" ],
}
_ = set_stored_msg_marker( "_last-warning_" )
# nb: we haven't made any changes, so we shouldn't get asked to confirm the "load scenario" operation
@@ -231,7 +231,7 @@ def test_unknown_vo( webapp, webdriver ):
last_warning = get_stored_msg( "_last-warning_" )
assert last_warning.startswith( "Unknown vehicles/ordnance:" )
for key,vals in SCENARIO_PARAMS.items():
- if not key.startswith( ("VEHICLES_","ORDNANCE_") ):
+ if not key.startswith( ("OB_VEHICLES_","OB_ORDNANCE_") ):
continue
assert all( v in last_warning for v in vals )
diff --git a/vasl_templates/webapp/tests/test_vehicles_ordnance.py b/vasl_templates/webapp/tests/test_vehicles_ordnance.py
index 05e8df6..942b0d3 100644
--- a/vasl_templates/webapp/tests/test_vehicles_ordnance.py
+++ b/vasl_templates/webapp/tests/test_vehicles_ordnance.py
@@ -54,7 +54,7 @@ def test_crud( webapp, webdriver ):
def _set_width( vo_type, player_no, width ):
"""Set the snippet width."""
select_tab( "ob{}".format( player_no ) )
- elem = find_child( "input[name='{}_WIDTH_{}']".format( vo_type.upper(), player_no ) )
+ elem = find_child( "input[name='OB_{}_WIDTH_{}']".format( vo_type.upper(), player_no ) )
elem.clear()
if width is not None:
elem.send_keys( str(width) )
@@ -64,7 +64,7 @@ def test_crud( webapp, webdriver ):
"""Check the generated vehicle/ordnance snippet."""
# check the snippet
select_tab( "ob{}".format( player_no ) )
- btn = find_child( "button[data-id='{}_{}']".format( vo_type, player_no ) )
+ btn = find_child( "button[data-id='ob_{}_{}']".format( vo_type, player_no ) )
btn.click()
buf = get_clipboard()
names = [
@@ -83,7 +83,7 @@ def test_crud( webapp, webdriver ):
def _check_hint( vo_type, player_no ):
"""Check the hint visibility."""
- hint = find_child( "#{}-hint_{}".format( vo_type, player_no ) )
+ hint = find_child( "#ob_{}-hint_{}".format( vo_type, player_no ) )
expected = "none" if _expected[(vo_type,player_no)] else "block"
assert hint.value_of_css_property("display") == expected
@@ -133,7 +133,7 @@ def test_snippets( webapp, webdriver ):
vo_type0 = vo_type[:-1] if vo_type.endswith("s") else vo_type
# test a full example
add_vo( vo_type, 1, "a german {}".format(vo_type) )
- btn = find_child( "button[data-id='{}_1']".format( vo_type ) )
+ btn = find_child( "button[data-id='ob_{}_1']".format( vo_type ) )
btn.click()
expected = [
'[German] ; width=',
@@ -149,7 +149,7 @@ def test_snippets( webapp, webdriver ):
# test a partial example
add_vo( vo_type, 1, "another german {}".format(vo_type) )
- btn = find_child( "button[data-id='{}_1']".format( vo_type ) )
+ btn = find_child( "button[data-id='ob_{}_1']".format( vo_type ) )
btn.click()
expected = [
'[German] ; width=',
@@ -164,7 +164,7 @@ def test_snippets( webapp, webdriver ):
# test a minimal example
add_vo( vo_type, 1, "name only" )
- btn = find_child( "button[data-id='{}_1']".format( vo_type ) )
+ btn = find_child( "button[data-id='ob_{}_1']".format( vo_type ) )
btn.click()
assert get_clipboard() == \
'''[German] ; width=
@@ -186,7 +186,7 @@ def test_variable_capabilities( webapp, webdriver ):
add_vo( "vehicles", 2, "Churchill III(b)" )
# change the scenario date and check the generated snippet
- vehicles2 = find_child( "button.generate[data-id='vehicles_2']" )
+ vehicles2 = find_child( "button.generate[data-id='ob_vehicles_2']" )
def do_test( month, year, expected ):
"""Set the date and check the vehicle snippet."""
select_tab( "scenario" )
@@ -215,7 +215,7 @@ def add_vo( vo_type, player_no, name ):
# add the vehicle/ordnance
select_tab( "ob{}".format( player_no ) )
- elem = find_child( "#{}-add_{}".format( vo_type, player_no ) )
+ elem = find_child( "#ob_{}-add_{}".format( vo_type, player_no ) )
elem.click()
sel = Select( find_child( "#select-vo select" ) )
sel.select_by_visible_text( name[:-1] if name.endswith("s") else name )
@@ -229,10 +229,10 @@ def delete_vo( vo_type, player_no, name, webdriver ):
# delete the vehicle/ordnance
select_tab( "ob{}".format( player_no ) )
elems = [
- c for c in find_children( "#{}-sortable_{} li".format( vo_type, player_no ) )
+ c for c in find_children( "#ob_{}-sortable_{} li".format( vo_type, player_no ) )
if c.text == name
]
assert len(elems) == 1
elem = elems[0]
- trash = find_child( "#{}-trash_{}".format( vo_type, player_no ) )
+ trash = find_child( "#ob_{}-trash_{}".format( vo_type, player_no ) )
ActionChains(webdriver).drag_and_drop( elem, trash ).perform()
diff --git a/vasl_templates/webapp/tests/utils.py b/vasl_templates/webapp/tests/utils.py
index 089a25b..71bc7f8 100644
--- a/vasl_templates/webapp/tests/utils.py
+++ b/vasl_templates/webapp/tests/utils.py
@@ -17,8 +17,8 @@ from selenium.common.exceptions import NoSuchElementException, StaleElementRefer
# standard templates
_STD_TEMPLATES = {
"scenario": [ "scenario", "players", "victory_conditions", "scenario_notes", "ssr" ],
- "ob1": [ "ob_setup_1", "ob_note_1", "vehicles_1", "ordnance_1" ],
- "ob2": [ "ob_setup_2", "ob_note_2", "vehicles_2", "ordnance_2" ],
+ "ob1": [ "ob_setup_1", "ob_note_1", "ob_vehicles_1", "ob_ordnance_1" ],
+ "ob2": [ "ob_setup_2", "ob_note_2", "ob_vehicles_2", "ob_ordnance_2" ],
}
# nationality-specific templates
@@ -63,12 +63,12 @@ def for_each_template( func ): #pylint: disable=too-many-branches
template_id = "ob_setup"
elif template_id.startswith( "ob_note_" ):
template_id = "ob_note"
- elif template_id.startswith( "vehicles_" ):
- template_id = "vehicles"
- elif template_id.startswith( "ordnance_" ):
- template_id = "ordnance"
+ elif template_id.startswith( "ob_vehicles_" ):
+ template_id = "ob_vehicles"
+ elif template_id.startswith( "ob_ordnance_" ):
+ template_id = "ob_ordnance"
func( template_id, orig_template_id )
- if orig_template_id not in ("ob_setup_2","ob_note_2","vehicles_2","ordnance_2"):
+ if orig_template_id not in ("ob_setup_2","ob_note_2","ob_vehicles_2","ob_ordnance_2"):
templates_to_test.remove( template_id )
# test the nationality-specific templates
@@ -147,10 +147,11 @@ def set_template_params( params ): #pylint: disable=too-many-branches
continue
# check for vehicles/ordnance (these require special handling)
- if key in ("VEHICLES_1","ORDNANCE_1","VEHICLES_2","ORDNANCE_2"):
+ if key in ("OB_VEHICLES_1","OB_ORDNANCE_1","OB_VEHICLES_2","OB_ORDNANCE_2"):
# add them in (nb: we don't consider any existing vehicles/ordnance)
from vasl_templates.webapp.tests.test_vehicles_ordnance import add_vo #pylint: disable=cyclic-import
- vo_type = key[:key.index("_")].lower()
+ mo = re.search( r"^OB_(VEHICLES|ORDNANCE)_\d$", key )
+ vo_type = mo.group(1).lower()
for vo_name in val:
add_vo( vo_type, int(key[-1]), vo_name )
continue