Bug 1460676 [wpt PR 10953] - Partly fix #8581: add extra subdomains for cookie tests, a=testonly

Automatic update from web-platform-testsMake it possible to override subdomains/not_subdomains in serve.Config

--
Partly fix #8581: add extra subdomains for cookie tests

--

wpt-commits: 9d4128a0306a6e050ece6e770faffc2813987308, ff4e72e977d0776510aea28ddfb497c7fc12e848
wpt-pr: 10953
This commit is contained in:
Geoffrey Sneddon 2018-08-15 10:00:52 +00:00 коммит произвёл moz-wptsync-bot
Родитель e2b8124c5e
Коммит e0881d51a7
3 изменённых файлов: 32 добавлений и 28 удалений

Просмотреть файл

@ -637654,11 +637654,11 @@
"support"
],
"tools/serve/serve.py": [
"bca2045ea2e330804c06762e8db7b0378b40fb4d",
"60636d8b7a9f4d8eb0f16316cf208affc88103f2",
"support"
],
"tools/serve/test_serve.py": [
"149ed0ebd9d46d3965cc59cd1db6eaf8c5fe70de",
"e939c3a0ccee4ac4f5babbcab3b9d30dbfa80be8",
"support"
],
"tools/third_party/atomicwrites/.gitignore": [

Просмотреть файл

@ -16,6 +16,7 @@ import traceback
from six.moves import urllib
import uuid
from collections import defaultdict, OrderedDict
from itertools import chain, product
from multiprocessing import Process, Event
from localpaths import repo_root
@ -702,6 +703,9 @@ def build_config(override_path=None, **kwargs):
return rv
def _make_subdomains_product(s, depth=3):
return set(u".".join(x) for x in chain(*(product(s, repeat=i) for i in range(1, depth+1))))
_subdomains = {u"www",
u"www1",
u"www2",
@ -710,6 +714,10 @@ _subdomains = {u"www",
_not_subdomains = {u"nonexistent"}
_subdomains = _make_subdomains_product(_subdomains)
_not_subdomains = _make_subdomains_product(_not_subdomains)
class ConfigBuilder(config.ConfigBuilder):
"""serve config
@ -754,9 +762,11 @@ class ConfigBuilder(config.ConfigBuilder):
computed_properties = ["ws_doc_root"] + config.ConfigBuilder.computed_properties
def __init__(self, *args, **kwargs):
if "subdomains" not in kwargs:
kwargs["subdomains"] = _subdomains
if "not_subdomains" not in kwargs:
kwargs["not_subdomains"] = _not_subdomains
super(ConfigBuilder, self).__init__(
subdomains=_subdomains,
not_subdomains=_not_subdomains,
*args,
**kwargs
)

Просмотреть файл

@ -14,22 +14,18 @@ from .serve import ConfigBuilder
def test_make_hosts_file_nix():
with ConfigBuilder(ports={"http": [8000]},
browser_host="foo.bar",
alternate_hosts={"alt": "foo2.bar"}) as c:
alternate_hosts={"alt": "foo2.bar"},
subdomains={"a", "b"},
not_subdomains={"x, y"}) as c:
hosts = serve.make_hosts_file(c, "192.168.42.42")
lines = hosts.split("\n")
assert set(lines) == {"",
"192.168.42.42\tfoo.bar",
"192.168.42.42\tfoo2.bar",
"192.168.42.42\twww.foo.bar",
"192.168.42.42\twww.foo2.bar",
"192.168.42.42\twww1.foo.bar",
"192.168.42.42\twww1.foo2.bar",
"192.168.42.42\twww2.foo.bar",
"192.168.42.42\twww2.foo2.bar",
"192.168.42.42\txn--lve-6lad.foo.bar",
"192.168.42.42\txn--lve-6lad.foo2.bar",
"192.168.42.42\txn--n8j6ds53lwwkrqhv28a.foo.bar",
"192.168.42.42\txn--n8j6ds53lwwkrqhv28a.foo2.bar"}
"192.168.42.42\ta.foo.bar",
"192.168.42.42\ta.foo2.bar",
"192.168.42.42\tb.foo.bar",
"192.168.42.42\tb.foo2.bar"}
assert lines[-1] == ""
@pytest.mark.skipif(platform.uname()[0] != "Windows",
@ -37,24 +33,22 @@ def test_make_hosts_file_nix():
def test_make_hosts_file_windows():
with ConfigBuilder(ports={"http": [8000]},
browser_host="foo.bar",
alternate_hosts={"alt": "foo2.bar"}) as c:
alternate_hosts={"alt": "foo2.bar"},
subdomains={"a", "b"},
not_subdomains={"x, y"}) as c:
hosts = serve.make_hosts_file(c, "192.168.42.42")
lines = hosts.split("\n")
assert set(lines) == {"",
"0.0.0.0\tnonexistent.foo.bar",
"0.0.0.0\tnonexistent.foo2.bar",
"0.0.0.0\tx.foo.bar",
"0.0.0.0\tx.foo2.bar",
"0.0.0.0\ty.foo.bar",
"0.0.0.0\ty.foo2.bar",
"192.168.42.42\tfoo.bar",
"192.168.42.42\tfoo2.bar",
"192.168.42.42\twww.foo.bar",
"192.168.42.42\twww.foo2.bar",
"192.168.42.42\twww1.foo.bar",
"192.168.42.42\twww1.foo2.bar",
"192.168.42.42\twww2.foo.bar",
"192.168.42.42\twww2.foo2.bar",
"192.168.42.42\txn--lve-6lad.foo.bar",
"192.168.42.42\txn--lve-6lad.foo2.bar",
"192.168.42.42\txn--n8j6ds53lwwkrqhv28a.foo.bar",
"192.168.42.42\txn--n8j6ds53lwwkrqhv28a.foo2.bar"}
"192.168.42.42\ta.foo.bar",
"192.168.42.42\ta.foo2.bar",
"192.168.42.42\tb.foo.bar",
"192.168.42.42\tb.foo2.bar"}
assert lines[-1] == ""