示例#1
0
  def testGetProjectIdFromHttpHostCustomDomain(self):
    os.environ['HTTP_HOST'] = 'www.mydomain.com'
    project_id = mimic.GetProjectIdFromHttpHost(os.environ)
    self.assertEquals('www', project_id)

    os.environ['HTTP_HOST'] = 'proj1.www.mydomain.com'
    project_id = mimic.GetProjectIdFromHttpHost(os.environ)
    self.assertEquals('proj1', project_id)
示例#2
0
  def testGetProjectIdFromHttpHostAppspot(self):
    os.environ['HTTP_HOST'] = 'project-id.your-app-id.appspot.com'
    project_id = mimic.GetProjectIdFromHttpHost(os.environ)
    self.assertEquals('project-id', project_id)

    # Must have project id subdomain
    self.CheckHostParseFailure('your-app-id.appspot.com')
    self.CheckHostParseFailure('some-other-app-id.appspot.com')
示例#3
0
 def testGetProjectIdFromHttpHostIpv4(self):
   os.environ['HTTP_HOST'] = '0.0.0.0'
   project_id = mimic.GetProjectIdFromHttpHost(os.environ)
   self.assertEquals(None, project_id)
示例#4
0
 def testGetProjectIdFromHttpHostCustomDomainDashDotDash(self):
   os.environ['HTTP_HOST'] = 'proj2-dot-www.mydomain.com'
   project_id = mimic.GetProjectIdFromHttpHost(os.environ)
   self.assertEquals('proj2', project_id)
示例#5
0
 def testGetProjectIdFromHttpHostLocalhost(self):
   os.environ['HTTP_HOST'] = 'localhost:8080'
   os.environ['SERVER_NAME'] = 'localhost'
   project_id = mimic.GetProjectIdFromHttpHost(os.environ)
   self.assertEquals(None, project_id)
示例#6
0
 def testGetProjectIdFromHttpHostAppspotDashDotDash(self):
   os.environ['HTTP_HOST'] = 'project-id-dot-your-app-id.appspot.com'
   project_id = mimic.GetProjectIdFromHttpHost(os.environ)
   self.assertEquals('project-id', project_id)
示例#7
0
 def testGetProjectIdFromHttpHostAppspotWithPort(self):
   os.environ['HTTP_HOST'] = 'project-id.your-app-id.appspot.com:12345'
   project_id = mimic.GetProjectIdFromHttpHost(os.environ)
   self.assertEquals('project-id', project_id)
示例#8
0
 def CheckHostParseFailure(self, http_host):
   os.environ['HTTP_HOST'] = http_host
   project_id = mimic.GetProjectIdFromHttpHost(os.environ)
   self.assertEquals(None, project_id)