tests: Disallow NUL for filesystem tests

From what I can see, there's no way for an user to enter a NUL byte.

Closes #6223
This commit is contained in:
Florian Bruhin 2021-03-02 17:43:00 +01:00
parent 70f778d418
commit 2cbbbe54c6
1 changed files with 5 additions and 5 deletions

View File

@ -28,7 +28,7 @@ from datetime import datetime
from unittest import mock
import hypothesis
import hypothesis.strategies
import hypothesis.strategies as hst
import pytest
from PyQt5.QtCore import QUrl, QDateTime
try:
@ -459,9 +459,9 @@ def test_filesystem_completion_model_interface(info, local_files_path):
@hypothesis.given(
as_uri=hypothesis.strategies.booleans(),
add_sep=hypothesis.strategies.booleans(),
text=hypothesis.strategies.text(),
as_uri=hst.booleans(),
add_sep=hst.booleans(),
text=hst.text(alphabet=hst.characters(blacklist_categories=['Cc'], blacklist_characters='\x00')),
)
def test_filesystem_completion_hypothesis(info, as_uri, add_sep, text):
if as_uri:
@ -1445,7 +1445,7 @@ def undo_completion_retains_sort_order(tabbed_browser_stubs, info):
_check_completions(model, {"Closed tabs": expected})
@hypothesis.given(text=hypothesis.strategies.text())
@hypothesis.given(text=hst.text())
def test_listcategory_hypothesis(text):
"""Make sure we can't produce invalid patterns."""
cat = listcategory.ListCategory("test", [])