diff --git a/pythonlib/camoufox/utils.py b/pythonlib/camoufox/utils.py index 317bb0b..5b125ef 100644 --- a/pythonlib/camoufox/utils.py +++ b/pythonlib/camoufox/utils.py @@ -1038,7 +1038,7 @@ def launch_options( # User passed a custom fingerprint if not i_know_what_im_doing: check_custom_fingerprint(fingerprint) - elif fingerprint_preset is not None: + elif fingerprint_preset: # User opted into real fingerprint presets if isinstance(fingerprint_preset, dict): preset = fingerprint_preset diff --git a/pythonlib/tests/test_identity_salt.py b/pythonlib/tests/test_identity_salt.py index f63ef7a..f371cea 100644 --- a/pythonlib/tests/test_identity_salt.py +++ b/pythonlib/tests/test_identity_salt.py @@ -162,3 +162,11 @@ class TestPrefsEnvIsAscii: joined = "".join(env[f"CAMOU_PREFS_{i}"] for i in range(1, len(env) + 1)) assert joined.isascii() assert orjson.loads(joined) == prefs + + +@pytest.mark.parametrize("off", [None, False]) +def test_fingerprint_preset_off_never_draws_a_preset(off): + """`fingerprint_preset=False` means off, the same as None. It used to be + checked with `is not None`, so False drew a random bundled preset.""" + with mock.patch.object(utils, "get_random_preset", side_effect=AssertionError("preset drawn")): + launch(fingerprint_preset=off)