-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathconfig_helper.py
More file actions
77 lines (61 loc) · 2.05 KB
/
config_helper.py
File metadata and controls
77 lines (61 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import re
import time
from urllib.parse import urljoin, urlencode
def get_base_url(base_url):
return base_url or "https://www.boost.org"
def build_url(base_url, path="/", cachebust=False, params=None):
url = urljoin(base_url.rstrip("/") + "/", path.lstrip("/"))
query_params = {}
if cachebust:
query_params["cachebust"] = str(int(time.time() * 1000))
if params:
query_params.update(params)
if query_params:
url += ("&" if "?" in url else "?") + urlencode(query_params)
return url
class UrlPatterns:
homepage = "/"
libraries = "/libraries/"
releases = "/releases/"
documentation = "/doc/libs/"
community = "/community/"
search = "/search/"
@staticmethod
def doc_libs_version(version="1_85_0"):
return f"/doc/libs/{version}/"
@staticmethod
def release_notes(version="1_85_0"):
return f"/doc/libs/{version}/libs/release_notes/"
class ExpectedUrlPatterns:
after_cta_click = re.compile(r"libraries|releases|docs|learn|download", re.I)
after_search = re.compile(r"search|results|q=", re.I)
after_logo_click = re.compile(r"/?$")
github_boost = re.compile(r"github\.com/boostorg", re.I)
download_site = re.compile(
r"archives\.boost\.io|github\.com/boostorg/boost/releases|download|release",
re.I,
)
community_links = re.compile(r"github.com.*issues|discourse|lists.boost.org", re.I)
url_patterns = UrlPatterns()
expected_url_patterns = ExpectedUrlPatterns()
class TestData:
search_terms = {
"working": "asio",
"alternative": "algorithm",
}
download_files = {
"tar_gz": re.compile(r"boost_1_74_0\.tar\.gz$"),
"zip": re.compile(r"boost_1_85_0\.zip$"),
"supported": re.compile(r"\.(zip|tar\.gz|tar\.bz2|7z|exe)$"),
}
timeouts = {
"short": 5000,
"medium": 15000,
"long": 30000,
"download": 60000,
}
viewport = {
"desktop": {"width": 1280, "height": 720},
"mobile": {"width": 800, "height": 600},
}
test_data = TestData()