Beispiel #1
0
 def testGetSecureHostName(self):
   """Tests that a hostname suitable for https requests is returned.
   """
   try:
     os.environ['APPLICATION_ID'] = 'test-app-run'
     expected_host = 'test-app-run.appspot.com'
     self.assertEqual(system.getSecureHostname(), expected_host)
   finally:
     if self.default_application_id is None:
       del os.environ['APPLICATION_ID']
     else:
       os.environ['APPLICATION_ID'] = self.default_application_id
Beispiel #2
0
  def _fullUrl(self, url, full, secure):
    """Returns the full version of the url iff full.

    The full version starts with http:// and includes getHostname().
    """
    if (not full) and (system.isLocal() or not secure):
      return url

    if secure:
      protocol = 'https'
      hostname = system.getSecureHostname()
    else:
      protocol = 'http'
      hostname = system.getHostname(self._data)

    return '%s://%s%s' % (protocol, hostname, url)