def test_no_scheme_specified(self): """ Test that, if no scheme has been specified, the https one will be used. """ hostname = '//transifex.net' hostname = hostname_ssl_migration(hostname) self.assertTrue(hostname.startswith('https://'))
def test_http_replacement(self): """Test the replacement of http with https.""" hostnames = [ 'http://transifex.com', 'http://transifex.net/http/', 'http://www.transifex.com/path/' ] for h in hostnames: hostname = hostname_ssl_migration(h) self.assertEqual(hostname[:8], 'https://') self.assertEqual(hostname[7:], h[6:])
def test_no_http_replacement_needed(self): """Test that http will not be replaces with https, when not needed.""" for h in ['http://example.com', 'http://example.com/http/']: hostname = hostname_ssl_migration(h) self.assertEqual(hostname, hostname)