diff options
author | Colin Watson <cjwatson@debian.org> | 2018-08-20 17:53:46 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2018-08-20 17:54:31 +0100 |
commit | f3d0400ea57884c6bd7f1d66352d3e44ad20e286 (patch) | |
tree | 9e826ffbdb7cb51825b67bd35a33de79ccb97356 /macaroonbakery/tests/test_utils.py | |
parent | ae33a39d857b367e216f1e80530c09087b108d16 (diff) | |
parent | 2105a515d749b74eef9a6bb6af008aa6a842e313 (diff) |
Update upstream source from tag 'upstream/1.1.4'
Update to upstream version '1.1.4'
with Debian dir 42ca954c317c7fd65bffdc0e0e6803556dccdf2f
Diffstat (limited to 'macaroonbakery/tests/test_utils.py')
-rw-r--r-- | macaroonbakery/tests/test_utils.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/macaroonbakery/tests/test_utils.py b/macaroonbakery/tests/test_utils.py index 65edeb4..4ed3e81 100644 --- a/macaroonbakery/tests/test_utils.py +++ b/macaroonbakery/tests/test_utils.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2017 Canonical Ltd. # Licensed under the LGPLv3, see LICENCE file for details. @@ -26,6 +28,26 @@ class CookieTest(TestCase): ValueError, cookie, 'http://example.com', 'test', 'value', expires=timestamp) + def test_cookie_with_hostname_not_fqdn(self): + c = cookie('http://myhost', 'test', 'value') + self.assertEqual(c.domain, 'myhost.local') + + def test_cookie_with_hostname_ipv4(self): + c = cookie('http://1.2.3.4', 'test', 'value') + self.assertEqual(c.domain, '1.2.3.4') + + def test_cookie_with_hostname_ipv6(self): + c = cookie('http://[dead::beef]', 'test', 'value') + self.assertEqual(c.domain, 'dead::beef') + + def test_cookie_with_hostname_like_ipv4(self): + c = cookie('http://1.2.3.4.com', 'test', 'value') + self.assertEqual(c.domain, '1.2.3.4.com') + + def test_cookie_with_hostname_not_ascii(self): + c = cookie('http://κουλουράκι', 'test', 'value') + self.assertEqual(c.domain, 'κουλουράκι.local') + class TestB64Decode(TestCase): def test_decode(self): |