mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update web-platform-tests to revision 81962ac8802223d038b188b6f9cb88a0a9c5beee
This commit is contained in:
parent
fe1a057bd1
commit
24183668c4
1960 changed files with 29853 additions and 10555 deletions
|
@ -1,12 +1,79 @@
|
|||
from . import serve
|
||||
import pickle
|
||||
import platform
|
||||
import os
|
||||
|
||||
def test_make_hosts_file():
|
||||
hosts = serve.make_hosts_file({
|
||||
"domains": {"www": "www.foo.bar.test", "www1": "www1.foo.bar.test"},
|
||||
"not_domains": {"aaa": "aaa.foo.bar.test", "bbb": "bbb.foo.bar.test"}
|
||||
}, "127.1.1.1")
|
||||
import pytest
|
||||
|
||||
import localpaths
|
||||
from . import serve
|
||||
from .serve import Config
|
||||
|
||||
|
||||
@pytest.mark.skipif(platform.uname()[0] == "Windows",
|
||||
reason="Expected contents are platform-dependent")
|
||||
def test_make_hosts_file_nix():
|
||||
c = Config(browser_host="foo.bar", alternate_hosts={"alt": "foo2.bar"})
|
||||
hosts = serve.make_hosts_file(c, "192.168.42.42")
|
||||
lines = hosts.split("\n")
|
||||
assert "127.1.1.1\twww.foo.bar.test" in lines
|
||||
assert "127.1.1.1\twww1.foo.bar.test" in lines
|
||||
assert "0.0.0.0\taaa.foo.bar.test" in lines
|
||||
assert "0.0.0.0\tbbb.foo.bar.test" in lines
|
||||
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"}
|
||||
assert lines[-1] == ""
|
||||
|
||||
@pytest.mark.skipif(platform.uname()[0] != "Windows",
|
||||
reason="Expected contents are platform-dependent")
|
||||
def test_make_hosts_file_windows():
|
||||
c = Config(browser_host="foo.bar", alternate_hosts={"alt": "foo2.bar"})
|
||||
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",
|
||||
"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"}
|
||||
assert lines[-1] == ""
|
||||
|
||||
|
||||
def test_ws_doc_root_default():
|
||||
c = Config()
|
||||
assert c.ws_doc_root == os.path.join(localpaths.repo_root, "websockets", "handlers")
|
||||
|
||||
|
||||
def test_init_ws_doc_root():
|
||||
c = Config(ws_doc_root="/")
|
||||
assert c.doc_root == localpaths.repo_root # check this hasn't changed
|
||||
assert c._ws_doc_root == "/"
|
||||
assert c.ws_doc_root == "/"
|
||||
|
||||
|
||||
def test_set_ws_doc_root():
|
||||
c = Config()
|
||||
c.ws_doc_root = "/"
|
||||
assert c.doc_root == localpaths.repo_root # check this hasn't changed
|
||||
assert c._ws_doc_root == "/"
|
||||
assert c.ws_doc_root == "/"
|
||||
|
||||
|
||||
def test_pickle():
|
||||
# Ensure that the config object can be pickled
|
||||
pickle.dumps(Config())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue