summaryrefslogtreecommitdiff
path: root/crocoite
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2019-01-10 16:24:54 +0100
committerLars-Dominik Braun <lars@6xq.net>2019-01-10 16:24:54 +0100
commit6b15b55896b1ff9f26891fa4a705b524d6d54020 (patch)
treecf35aa4e2d8da35c0301c80dc4ec41c9c04ec3fb /crocoite
parent94ebf09d75a955209703f8c4807c19e17c8fa9e8 (diff)
downloadcrocoite-6b15b55896b1ff9f26891fa4a705b524d6d54020.tar.gz
crocoite-6b15b55896b1ff9f26891fa4a705b524d6d54020.tar.bz2
crocoite-6b15b55896b1ff9f26891fa4a705b524d6d54020.zip
browser: Use hypothesis’ domains()
Fixes test.
Diffstat (limited to 'crocoite')
-rw-r--r--crocoite/test_browser.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/crocoite/test_browser.py b/crocoite/test_browser.py
index 4bf2c64..7727259 100644
--- a/crocoite/test_browser.py
+++ b/crocoite/test_browser.py
@@ -29,6 +29,7 @@ from multidict import CIMultiDict
from hypothesis import given
import hypothesis.strategies as st
+from hypothesis.provisional import domains
import pytest
from .browser import RequestResponsePair, SiteLoader, VarChangeEvent, Request, \
@@ -119,10 +120,6 @@ def test_referencetimestamp (relativeA, absoluteA, relativeB):
(absoluteA >= absoluteB and relativeA >= relativeB)
assert abs ((absoluteB - absoluteA).total_seconds () - (relativeB - relativeA)) < 10e-6
-def hostname ():
- # XXX: find a better way to generate hostnames
- return st.text (alphabet=st.sampled_from('abcdefghijklmnopqrstuvwxyz0123456789-'), min_size=1, max_size=253)
-
def urls ():
""" Build http/https URL """
scheme = st.sampled_from (['http', 'https'])
@@ -130,7 +127,7 @@ def urls ():
pathSt = st.builds (lambda x: '/' + x, st.text ())
args = st.fixed_dictionaries ({
'scheme': scheme,
- 'host': hostname (),
+ 'host': domains (),
'port': st.one_of (st.none (), st.integers (min_value=1, max_value=2**16-1)),
'path': pathSt,
'query_string': st.text (),