Commits

Kelsey Hightower  committed fff7d82

Fixes based on feedback from Alexis and Antoine Pitrou

  • Participants
  • Parent commits 2c4b612

Comments (0)

Files changed (1)

File mirror-authenticity

 new file mode 100644
 --- /dev/null
 +++ b/distutils2/tests/test_index_mirrors.py
-@@ -0,0 +1,91 @@
+@@ -0,0 +1,89 @@
 +"""Tests for the distutils2.index.mirrors module."""
 +
 +import os
 +        url = server.full_address
 +        expected = open(SERVER_KEY, 'rb').read()
 +
-+        # test retrieving a server key when the server key cache
-+        # is missing.
++        # Test retrieving a server key when the server key cache is missing.
 +        self.assertRaises(ServerKeyError, get_server_key, path=MISSING_FILE,
 +                          use_cache=True)
 +
-+        # test retrieving a server key when the server key cache
-+        # is available
++        # Test retrieving a server key when the server key cache is available.
 +        server_key = get_server_key(path=SERVER_KEY, use_cache=True)
 +        self.assertEqual(expected, server_key)
 +
-+        # test retrieving a server key when the SSL cert is invalid
++        # Test retrieving a server key when the SSL cert is invalid
 +        # because no ca_certs where supplied.
 +        self.assertRaises(ServerKeyError, get_server_key, use_cache=False,
 +                          url=url)
 +
-+        # test retrieving a server key when the SSL cert is valid.
++        # Test retrieving a server key when the SSL cert is valid.
 +        # 'url' is not a valid SSL url causing 'url_opener.open' to skip
 +        # SSL validation.
 +        server_key = get_server_key(url, use_cache=False, ca_certs=CA_CERTS)
 +        self.assertEqual(expected, server_key)
 +
-+        # test retrieving a server key when the SSL cert is invalid
-+        # need a better way to test SSL; is a test SSL server needed?
++        # Test retrieving a server key when the SSL cert is invalid.
++        # Need a better way to test SSL; is a test PyPI SSL server needed?
 +        _get_serverkey = mirrors._get_serverkey
 +        mirrors._get_serverkey = MockSSLPyPI(_exception=CertificateError)
 +        self.assertRaises(CertificateError, get_server_key, use_cache=False,
 +    @use_http_server(static_filesystem_paths=['test_project_verification'],
 +                     static_uri_paths=['serverkey', 'simple', 'serversig'])
 +    def test_is_trustable(self, server):
-+        # test verifying a project page when all arguments are set to None.
++        # Test verifying a mirror when all arguments are set to None.
 +        url, project, server_key = None, None, None
 +        results = is_trustable(url, project, server_key)
 +        self.assertFalse(results)
 +
-+        # test verifying a project
++        # Test verifying a mirror.
 +        url = server.full_address
-+        # need to add the '/' here to make sure the test http server
++        # Need to add the '/' here to make sure the test http server
 +        # finds the index.html page. This is not required when verifying
 +        # against PyPI mirrors.
 +        project = 'distutils2/'