diff options
Diffstat (limited to 'tests/unit/javascript/test_greasemonkey.py')
-rw-r--r-- | tests/unit/javascript/test_greasemonkey.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unit/javascript/test_greasemonkey.py b/tests/unit/javascript/test_greasemonkey.py index 2bfb9ca83..17847816d 100644 --- a/tests/unit/javascript/test_greasemonkey.py +++ b/tests/unit/javascript/test_greasemonkey.py @@ -131,6 +131,20 @@ def test_no_name_with_fallback(): assert script.name == r"C:\COM1" +@pytest.mark.parametrize('properties, inc_counter, expected', [ + ([("name", "gorilla")], False, "GM-gorilla"), + ([("namespace", "apes"), ("name", "gorilla")], False, "GM-apes/gorilla"), + + ([("name", "gorilla")], True, "GM-gorilla-2"), + ([("namespace", "apes"), ("name", "gorilla")], True, "GM-apes/gorilla-2"), +]) +def test_full_name(properties, inc_counter, expected): + script = greasemonkey.GreasemonkeyScript(properties, code="") + if inc_counter: + script.dedup_suffix += 1 + assert script.full_name() == expected + + def test_bad_scheme(caplog): """qute:// isn't in the list of allowed schemes.""" _save_script("var nothing = true;\n", 'nothing.user.js') |