Commit 22d0a57a authored by Jason Madden's avatar Jason Madden

Update tests

parent a8bde021
...@@ -500,7 +500,7 @@ class BasicSocketTests(unittest.TestCase): ...@@ -500,7 +500,7 @@ class BasicSocketTests(unittest.TestCase):
('email', 'null@python.org\x00user@example.org'), ('email', 'null@python.org\x00user@example.org'),
('URI', 'http://null.python.org\x00http://example.org'), ('URI', 'http://null.python.org\x00http://example.org'),
('IP Address', '192.0.2.1'), ('IP Address', '192.0.2.1'),
('IP Address', '2001:DB8:0:0:0:0:0:1\n')) ('IP Address', '2001:DB8:0:0:0:0:0:1'))
else: else:
# OpenSSL 0.9.7 doesn't support IPv6 addresses in subjectAltName # OpenSSL 0.9.7 doesn't support IPv6 addresses in subjectAltName
san = (('DNS', 'altnull.python.org\x00example.com'), san = (('DNS', 'altnull.python.org\x00example.com'),
...@@ -527,7 +527,7 @@ class BasicSocketTests(unittest.TestCase): ...@@ -527,7 +527,7 @@ class BasicSocketTests(unittest.TestCase):
(('commonName', 'dirname example'),))), (('commonName', 'dirname example'),))),
('URI', 'https://www.python.org/'), ('URI', 'https://www.python.org/'),
('IP Address', '127.0.0.1'), ('IP Address', '127.0.0.1'),
('IP Address', '0:0:0:0:0:0:0:1\n'), ('IP Address', '0:0:0:0:0:0:0:1'),
('Registered ID', '1.2.3.4.5') ('Registered ID', '1.2.3.4.5')
) )
) )
...@@ -554,11 +554,11 @@ class BasicSocketTests(unittest.TestCase): ...@@ -554,11 +554,11 @@ class BasicSocketTests(unittest.TestCase):
# Some sanity checks follow # Some sanity checks follow
# >= 0.9 # >= 0.9
self.assertGreaterEqual(n, 0x900000) self.assertGreaterEqual(n, 0x900000)
# < 3.0 # < 4.0
self.assertLess(n, 0x30000000) self.assertLess(n, 0x40000000)
major, minor, fix, patch, status = t major, minor, fix, patch, status = t
self.assertGreaterEqual(major, 0) self.assertGreaterEqual(major, 1)
self.assertLess(major, 3) self.assertLess(major, 4)
self.assertGreaterEqual(minor, 0) self.assertGreaterEqual(minor, 0)
self.assertLess(minor, 256) self.assertLess(minor, 256)
self.assertGreaterEqual(fix, 0) self.assertGreaterEqual(fix, 0)
...@@ -1220,12 +1220,18 @@ class ContextTests(unittest.TestCase): ...@@ -1220,12 +1220,18 @@ class ContextTests(unittest.TestCase):
# RHEL 8 uses TLS 1.2 by default # RHEL 8 uses TLS 1.2 by default
ssl.TLSVersion.TLSv1_2 ssl.TLSVersion.TLSv1_2
} }
maximum_range = {
# stock OpenSSL
ssl.TLSVersion.MAXIMUM_SUPPORTED,
# Fedora 32 uses TLS 1.3 by default
ssl.TLSVersion.TLSv1_3
}
self.assertIn( self.assertIn(
ctx.minimum_version, minimum_range ctx.minimum_version, minimum_range
) )
self.assertEqual( self.assertIn(
ctx.maximum_version, ssl.TLSVersion.MAXIMUM_SUPPORTED ctx.maximum_version, maximum_range
) )
ctx.minimum_version = ssl.TLSVersion.TLSv1_1 ctx.minimum_version = ssl.TLSVersion.TLSv1_1
......
...@@ -485,7 +485,7 @@ class BasicSocketTests(unittest.TestCase): ...@@ -485,7 +485,7 @@ class BasicSocketTests(unittest.TestCase):
('email', 'null@python.org\x00user@example.org'), ('email', 'null@python.org\x00user@example.org'),
('URI', 'http://null.python.org\x00http://example.org'), ('URI', 'http://null.python.org\x00http://example.org'),
('IP Address', '192.0.2.1'), ('IP Address', '192.0.2.1'),
('IP Address', '2001:DB8:0:0:0:0:0:1\n')) ('IP Address', '2001:DB8:0:0:0:0:0:1'))
else: else:
# OpenSSL 0.9.7 doesn't support IPv6 addresses in subjectAltName # OpenSSL 0.9.7 doesn't support IPv6 addresses in subjectAltName
san = (('DNS', 'altnull.python.org\x00example.com'), san = (('DNS', 'altnull.python.org\x00example.com'),
...@@ -512,7 +512,7 @@ class BasicSocketTests(unittest.TestCase): ...@@ -512,7 +512,7 @@ class BasicSocketTests(unittest.TestCase):
(('commonName', 'dirname example'),))), (('commonName', 'dirname example'),))),
('URI', 'https://www.python.org/'), ('URI', 'https://www.python.org/'),
('IP Address', '127.0.0.1'), ('IP Address', '127.0.0.1'),
('IP Address', '0:0:0:0:0:0:0:1\n'), ('IP Address', '0:0:0:0:0:0:0:1'),
('Registered ID', '1.2.3.4.5') ('Registered ID', '1.2.3.4.5')
) )
) )
...@@ -539,11 +539,11 @@ class BasicSocketTests(unittest.TestCase): ...@@ -539,11 +539,11 @@ class BasicSocketTests(unittest.TestCase):
# Some sanity checks follow # Some sanity checks follow
# >= 0.9 # >= 0.9
self.assertGreaterEqual(n, 0x900000) self.assertGreaterEqual(n, 0x900000)
# < 3.0 # < 4.0
self.assertLess(n, 0x30000000) self.assertLess(n, 0x40000000)
major, minor, fix, patch, status = t major, minor, fix, patch, status = t
self.assertGreaterEqual(major, 0) self.assertGreaterEqual(major, 1)
self.assertLess(major, 3) self.assertLess(major, 4)
self.assertGreaterEqual(minor, 0) self.assertGreaterEqual(minor, 0)
self.assertLess(minor, 256) self.assertLess(minor, 256)
self.assertGreaterEqual(fix, 0) self.assertGreaterEqual(fix, 0)
...@@ -1200,12 +1200,18 @@ class ContextTests(unittest.TestCase): ...@@ -1200,12 +1200,18 @@ class ContextTests(unittest.TestCase):
# RHEL 8 uses TLS 1.2 by default # RHEL 8 uses TLS 1.2 by default
ssl.TLSVersion.TLSv1_2 ssl.TLSVersion.TLSv1_2
} }
maximum_range = {
# stock OpenSSL
ssl.TLSVersion.MAXIMUM_SUPPORTED,
# Fedora 32 uses TLS 1.3 by default
ssl.TLSVersion.TLSv1_3
}
self.assertIn( self.assertIn(
ctx.minimum_version, minimum_range ctx.minimum_version, minimum_range
) )
self.assertEqual( self.assertIn(
ctx.maximum_version, ssl.TLSVersion.MAXIMUM_SUPPORTED ctx.maximum_version, maximum_range
) )
ctx.minimum_version = ssl.TLSVersion.TLSv1_1 ctx.minimum_version = ssl.TLSVersion.TLSv1_1
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment