Backed out changeset cd2147b5bc3d (bug 1407695)

--HG--
extra : rebase_source : 3bef6db8d9dd8d496dd5315dce7646b89e9911a8
This commit is contained in:
Sebastian Hengst 2017-10-24 18:48:42 +02:00
Родитель 05d81b9ad8
Коммит 6db78e3057
1 изменённых файлов: 1 добавлений и 30 удалений

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

@ -1,6 +1,5 @@
from tests.support.inline import inline
from tests.support.fixtures import clear_all_cookies
from datetime import datetime, timedelta
def test_get_named_session_cookie(session, url):
session.url = url("/common/blank.html")
@ -32,35 +31,6 @@ def test_get_named_session_cookie(session, url):
assert cookie["name"] == "foo"
assert cookie["value"] == "bar"
def test_get_named_cookie(session, url):
session.url = url("/common/blank.html")
clear_all_cookies(session)
# same formatting as Date.toUTCString() in javascript
utc_string_format = "%a, %d %b %Y %H:%M:%S"
a_year_from_now = (datetime.utcnow() + timedelta(days=365)).strftime(utc_string_format)
session.execute_script("document.cookie = 'foo=bar;expires=%s'" % a_year_from_now)
result = session.transport.send("GET", "session/%s/cookie" % session.session_id)
assert result.status == 200
assert "value" in result.body
assert isinstance(result.body["value"], list)
assert len(result.body["value"]) == 1
assert isinstance(result.body["value"][0], dict)
cookie = result.body["value"][0]
assert "name" in cookie
assert isinstance(cookie["name"], basestring)
assert "value" in cookie
assert isinstance(cookie["value"], basestring)
assert "expiry" in cookie
assert isinstance(cookie["expiry"], (int, long))
assert cookie["name"] == "foo"
assert cookie["value"] == "bar"
# convert from seconds since epoch
assert datetime.utcfromtimestamp(cookie["expiry"]).strftime(utc_string_format) == a_year_from_now
def test_duplicated_cookie(session, url):
session.url = url("/common/blank.html")
clear_all_cookies(session)
@ -95,3 +65,4 @@ def test_duplicated_cookie(session, url):
assert cookie["name"] == "hello"
assert cookie["value"] == "newworld"