|
@@ -19,6 +19,7 @@ class TestVisitRequest:
|
|
|
assert str(req.url) == "https://example.com/"
|
|
assert str(req.url) == "https://example.com/"
|
|
|
assert req.screenshot is False
|
|
assert req.screenshot is False
|
|
|
assert req.waitUntil == "load"
|
|
assert req.waitUntil == "load"
|
|
|
|
|
+ assert req.waitTime == 0
|
|
|
assert req.proxy is None
|
|
assert req.proxy is None
|
|
|
assert req.proxyAuth is None
|
|
assert req.proxyAuth is None
|
|
|
assert req.incognito is False
|
|
assert req.incognito is False
|
|
@@ -28,16 +29,31 @@ class TestVisitRequest:
|
|
|
url="https://example.com",
|
|
url="https://example.com",
|
|
|
screenshot=True,
|
|
screenshot=True,
|
|
|
waitUntil="networkidle",
|
|
waitUntil="networkidle",
|
|
|
|
|
+ waitTime=10,
|
|
|
proxy="http://proxy:8080",
|
|
proxy="http://proxy:8080",
|
|
|
proxyAuth={"username": "user", "password": "pass"},
|
|
proxyAuth={"username": "user", "password": "pass"},
|
|
|
incognito=True,
|
|
incognito=True,
|
|
|
)
|
|
)
|
|
|
assert req.screenshot is True
|
|
assert req.screenshot is True
|
|
|
assert req.waitUntil == "networkidle"
|
|
assert req.waitUntil == "networkidle"
|
|
|
|
|
+ assert req.waitTime == 10
|
|
|
assert req.proxy == "http://proxy:8080"
|
|
assert req.proxy == "http://proxy:8080"
|
|
|
assert req.proxyAuth["username"] == "user"
|
|
assert req.proxyAuth["username"] == "user"
|
|
|
assert req.incognito is True
|
|
assert req.incognito is True
|
|
|
|
|
|
|
|
|
|
+ def test_wait_time_negative_rejected(self):
|
|
|
|
|
+ with pytest.raises(ValidationError):
|
|
|
|
|
+ VisitRequest(url="https://example.com", waitTime=-1)
|
|
|
|
|
+
|
|
|
|
|
+ def test_wait_time_above_max_rejected(self):
|
|
|
|
|
+ with pytest.raises(ValidationError):
|
|
|
|
|
+ VisitRequest(url="https://example.com", waitTime=61)
|
|
|
|
|
+
|
|
|
|
|
+ def test_wait_time_boundary_values(self):
|
|
|
|
|
+ # Both 0 and 60 should be valid
|
|
|
|
|
+ VisitRequest(url="https://example.com", waitTime=0)
|
|
|
|
|
+ VisitRequest(url="https://example.com", waitTime=60)
|
|
|
|
|
+
|
|
|
def test_invalid_url_raises_error(self):
|
|
def test_invalid_url_raises_error(self):
|
|
|
with pytest.raises(ValidationError):
|
|
with pytest.raises(ValidationError):
|
|
|
VisitRequest(url="not-a-url")
|
|
VisitRequest(url="not-a-url")
|