diff --git a/.pylintrc b/.pylintrc index f176a41..8be7546 100644 --- a/.pylintrc +++ b/.pylintrc @@ -77,6 +77,7 @@ disable= consider-using-max-builtin, use-implicit-booleaness-not-comparison, unnecessary-lambda-assignment, + duplicate-string-formatting-argument, # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option diff --git a/vasl_templates/webapp/static/main.js b/vasl_templates/webapp/static/main.js index 2923531..8b47708 100644 --- a/vasl_templates/webapp/static/main.js +++ b/vasl_templates/webapp/static/main.js @@ -29,7 +29,7 @@ var NATIONALITY_SPECIFIC_BUTTONS = { "baz50": [ "american@korea", "kfw-rok", "kfw-ounc" ], "baz-cpva16": [ "kfw-cpva" ], "baz-cpva17": [ "kfw-cpva" ], - "piat": [ "british" ], + "piat": [ "british", "british~canadian" ], "thh": [ "japanese" ], } ; diff --git a/vasl_templates/webapp/tests/test_ob.py b/vasl_templates/webapp/tests/test_ob.py index 1c0c964..88bc570 100644 --- a/vasl_templates/webapp/tests/test_ob.py +++ b/vasl_templates/webapp/tests/test_ob.py @@ -124,7 +124,7 @@ def test_nationality_specific( webapp, webdriver ): #pylint: disable=too-many-lo ) # initialize - def check_pf_snippets(): + def check_pf_snippets( nat ): #pylint: disable=unused-argument """Check that the PF snippets are generated correctly.""" btn = find_child( "button[data-id='pf']" ) col = "[OBCOL:german]/[OBCOL-BORDER:german]" @@ -138,7 +138,7 @@ def test_nationality_specific( webapp, webdriver ): #pylint: disable=too-many-lo do_check_snippets( btn, (1946,1), "PF: range=[3] ; check=[4] ; col={}".format(col), False ) # initialize - def check_psk_snippets(): + def check_psk_snippets( nat ): #pylint: disable=unused-argument """Check that the PSK snippets are generated correctly.""" btn = find_child( "button[data-id='psk']" ) expected = "====> whoosh! ; col=[OBCOL:german]/[OBCOL-BORDER:german]" @@ -148,7 +148,7 @@ def test_nationality_specific( webapp, webdriver ): #pylint: disable=too-many-lo do_check_snippets( btn, (1944,1), expected, False ) # initialize - def check_baz_snippets(): + def check_baz_snippets( nat ): #pylint: disable=unused-argument """Check that the BAZ snippets are generated correctly.""" btn = find_child( "button[data-id='baz']" ) do_check_snippets( btn, (1941,1), "BAZ: none", True ) @@ -167,7 +167,14 @@ def test_nationality_specific( webapp, webdriver ): #pylint: disable=too-many-lo ) # initialize - def check_atmm_snippets(): + def check_piat_snippets( nat ): + """Check that the PIAT snippets are generated correctly.""" + wait_for_clipboard( 2, + "piat template ; col=[OBCOL:{}]/[OBCOL-BORDER:{}]".format( nat, nat ) + ) + + # initialize + def check_atmm_snippets( nat ): #pylint: disable=unused-argument """Check that the ATMM snippets are generated correctly.""" btn = find_child( "button[data-id='atmm']" ) expected = "Kaboom!!! ; col=[OBCOL:german]/[OBCOL-BORDER:german]" @@ -188,7 +195,7 @@ def test_nationality_specific( webapp, webdriver ): #pylint: disable=too-many-lo "baz50": [ ("american","Korea"), "BAZ 50 (from K:FW)" ], "baz-cpva16": [ "kfw-cpva", "BAZ 44 (from K:FW)" ], "baz-cpva17": [ "kfw-cpva", "BAZ Type 51 (from K:FW)" ], - "piat": [ "british", "piat template ; col=[OBCOL:british]/[OBCOL-BORDER:british]" ], + "piat": [ ["british","british~canadian"], check_piat_snippets ], "thh": [ "japanese", "Banzai!!!" ], } btn_elems = { @@ -207,11 +214,14 @@ def test_nationality_specific( webapp, webdriver ): #pylint: disable=too-many-lo for button_id,expected in nationality_specific_buttons.items(): elem = btn_elems[ button_id ] if isinstance( expected[0], str ): - nat2 = expected[0] + expected_nats = [ expected[0] ] + elif isinstance( expected[0], list ): + expected_nats = expected[0] else: - nat2 = expected[0][0] + assert isinstance( expected[0], tuple ) + expected_nats = [ expected[0][0] ] set_theater( expected[0][1] ) - if nat == nat2: + if nat in expected_nats: # the button should be shown for this nationality assert elem.is_displayed() # make sure that the template works @@ -219,7 +229,7 @@ def test_nationality_specific( webapp, webdriver ): #pylint: disable=too-many-lo if isinstance( expected[1], str ): wait_for_clipboard( 2, expected[1] ) elif isinstance( expected[1], types.FunctionType ): - expected[1]() #pylint: disable=not-callable + expected[1]( nat ) #pylint: disable=not-callable else: assert False else: