示例#1
0
 def testCGIScript(self):
   config = yaml.load(APP_YAML)
   handler = {'url': '/', 'script': 'main.py'}
   config['handlers'] = [handler]
   # CGI handlers supported only when threadsafe is false
   config['threadsafe'] = False
   target_info._ValidateConfig(config)
示例#2
0
 def testCGIScript(self):
     config = yaml.load(APP_YAML)
     handler = {'url': '/', 'script': 'main.py'}
     config['handlers'] = [handler]
     # CGI handlers supported only when threadsafe is false
     config['threadsafe'] = False
     target_info._ValidateConfig(config)
示例#3
0
 def testMimeTypeOnStaticFiles(self):
   config = yaml.load(APP_YAML)
   handler = {'url': '/x(.*)x', 'static_files': r'static/\1',
              'upload': 'static/.*', 'mime_type': 'image/gif',
              'expiration': '10m'}
   config['handlers'] = [handler]
   target_info._ValidateConfig(config)
示例#4
0
    def testSkipFiles(self):
        config = yaml.load(APP_YAML + r"""
skip_files:
- ^(.*/)?skip_folder.*
- ^(.*/)?README\.txt
""")
        target_info._ValidateConfig(config)
示例#5
0
  def testSkipFiles(self):
    config = yaml.load(APP_YAML + r"""
skip_files:
- ^(.*/)?skip_folder.*
- ^(.*/)?README\.txt
""")
    target_info._ValidateConfig(config)
示例#6
0
 def testStaticFiles(self):
   config = yaml.load(APP_YAML)
   handler = {'url': '/x(.*)x', 'static_files': r'static/\1',
              'expiration': '10m'}
   config['handlers'] = [handler]
   self.CheckError(config)
   handler['upload'] = 'static/.*'
   target_info._ValidateConfig(config)
示例#7
0
 def testCGIModuleValidation(self):
     config = yaml.load(APP_YAML)
     handler = {'url': '/', 'script': 'foo/bar'}
     config['handlers'] = [handler]
     # CGI handlers aren't supported when threadsafe is true
     self.assertRaises(target_info.ValidationError,
                       target_info._ValidateConfig, config)
     # should pass if threadsafe is false
     config['threadsafe'] = False
     target_info._ValidateConfig(config)
示例#8
0
 def testCGIModuleValidation(self):
   config = yaml.load(APP_YAML)
   handler = {'url': '/', 'script': 'foo/bar'}
   config['handlers'] = [handler]
   # CGI handlers aren't supported when threadsafe is true
   self.assertRaises(target_info.ValidationError, target_info._ValidateConfig,
                     config)
   # should pass if threadsafe is false
   config['threadsafe'] = False
   target_info._ValidateConfig(config)
示例#9
0
 def Check(handler):
   config = yaml.load(APP_YAML)
   config['handlers'] = [handler]
   handler['login'] = '******'
   target_info._ValidateConfig(config)
   handler['login'] = '******'
   target_info._ValidateConfig(config)
   handler['login'] = '******'
   self.assertRaises(target_info.ValidationError,
                     target_info._ValidateConfig, config)
示例#10
0
    def testLibraries(self):
        config = yaml.load(APP_YAML + """
libraries:
- name: webapp2
  version: to_be_set
""")
        valid_versions = ('latest', '2.5.2')
        for version in valid_versions:
            config['libraries'][0]['version'] = version
            target_info._ValidateConfig(config)
示例#11
0
  def testLibraries(self):
    config = yaml.load(APP_YAML + """
libraries:
- name: webapp2
  version: to_be_set
""")
    valid_versions = ('latest', '2.5.2')
    for version in valid_versions:
      config['libraries'][0]['version'] = version
      target_info._ValidateConfig(config)
示例#12
0
 def Check(handler):
     config = yaml.load(APP_YAML)
     config['handlers'] = [handler]
     handler['login'] = '******'
     target_info._ValidateConfig(config)
     handler['login'] = '******'
     target_info._ValidateConfig(config)
     handler['login'] = '******'
     self.assertRaises(target_info.ValidationError,
                       target_info._ValidateConfig, config)
示例#13
0
 def testMimeTypeOnStaticFiles(self):
     config = yaml.load(APP_YAML)
     handler = {
         'url': '/x(.*)x',
         'static_files': r'static/\1',
         'upload': 'static/.*',
         'mime_type': 'image/gif',
         'expiration': '10m'
     }
     config['handlers'] = [handler]
     target_info._ValidateConfig(config)
示例#14
0
 def testStaticFiles(self):
     config = yaml.load(APP_YAML)
     handler = {
         'url': '/x(.*)x',
         'static_files': r'static/\1',
         'expiration': '10m'
     }
     config['handlers'] = [handler]
     self.CheckError(config)
     handler['upload'] = 'static/.*'
     target_info._ValidateConfig(config)
示例#15
0
 def testHandlerExpiration(self):
     config = yaml.load(APP_YAML)
     config['handlers'].append({
         'url': '/x(.*)x',
         'static_files': r'static/\1',
         'upload': 'static/.*'
     })
     for value in VALID_EXPIRATIONS:
         for config_handler in config['handlers']:
             config_handler['expiration'] = value
         # should pass
         target_info._ValidateConfig(config)
示例#16
0
 def testHandlerExpiration(self):
   config = yaml.load(APP_YAML)
   config['handlers'].append({
       'url': '/x(.*)x',
       'static_files': r'static/\1',
       'upload': 'static/.*'
   })
   for value in VALID_EXPIRATIONS:
     for config_handler in config['handlers']:
       config_handler['expiration'] = value
     # should pass
     target_info._ValidateConfig(config)
示例#17
0
 def testHandlerSecure(self):
   config = yaml.load(APP_YAML)
   config['handlers'].extend([{
       'url': '/x(.*)x',
       'static_files': r'static/\1',
       'upload': 'static/.*'
   }, {
       'url': '/y(.*)y',
       'script': 'y.app',
   }])
   for value in VALID_SECURES:
     for config_handler in config['handlers']:
       config_handler['secure'] = value
     # should pass
     target_info._ValidateConfig(config)
示例#18
0
 def testHandlerSecure(self):
     config = yaml.load(APP_YAML)
     config['handlers'].extend([{
         'url': '/x(.*)x',
         'static_files': r'static/\1',
         'upload': 'static/.*'
     }, {
         'url': '/y(.*)y',
         'script': 'y.app',
     }])
     for value in VALID_SECURES:
         for config_handler in config['handlers']:
             config_handler['secure'] = value
         # should pass
         target_info._ValidateConfig(config)
示例#19
0
    def testBuiltinDeferred(self):
        config = yaml.load(APP_YAML + """
builtins:
- deferred: on
""")
        target_info._ValidateConfig(config)
示例#20
0
  def testMimeTypeOnStaticDir(self):
    config = yaml.load(APP_YAML + """
  mime_type: text/plain; charset=utf-8
""")
    target_info._ValidateConfig(config)
示例#21
0
  def testBuiltinDatastoreAdmin(self):
    config = yaml.load(APP_YAML + """
builtins:
- datastore_admin: on
""")
    target_info._ValidateConfig(config)
示例#22
0
  def testBuiltinAdminRedirect(self):
    config = yaml.load(APP_YAML + """
builtins:
- admin_redirect: on
""")
    target_info._ValidateConfig(config)
示例#23
0
  def testBuiltinRemoteApi(self):
    config = yaml.load(APP_YAML + """
builtins:
- remote_api: on
""")
    target_info._ValidateConfig(config)
示例#24
0
  def testBuiltinDeferred(self):
    config = yaml.load(APP_YAML + """
builtins:
- deferred: on
""")
    target_info._ValidateConfig(config)
示例#25
0
  def testBuiltinAppstats(self):
    config = yaml.load(APP_YAML + """
builtins:
- appstats: on
""")
    target_info._ValidateConfig(config)
示例#26
0
 def testDefaultExpiration(self):
     config = yaml.load(APP_YAML)
     for value in VALID_EXPIRATIONS:
         config['default_expiration'] = value
         # should pass
         target_info._ValidateConfig(config)
示例#27
0
 def testDefaultExpiration(self):
   config = yaml.load(APP_YAML)
   for value in VALID_EXPIRATIONS:
     config['default_expiration'] = value
     # should pass
     target_info._ValidateConfig(config)
示例#28
0
 def testWSGIScript(self):
     config = yaml.load(APP_YAML)
     handler = {'url': '/', 'script': 'main.app'}
     config['handlers'] = [handler]
     target_info._ValidateConfig(config)
示例#29
0
    def testBuiltinRemoteApi(self):
        config = yaml.load(APP_YAML + """
builtins:
- remote_api: on
""")
        target_info._ValidateConfig(config)
示例#30
0
 def testOk(self):
     target_info._ValidateConfig(yaml.load(APP_YAML))
示例#31
0
 def testOk(self):
   target_info._ValidateConfig(yaml.load(APP_YAML))
示例#32
0
    def testBuiltinDatastoreAdmin(self):
        config = yaml.load(APP_YAML + """
builtins:
- datastore_admin: on
""")
        target_info._ValidateConfig(config)
示例#33
0
    def testBuiltinAppstats(self):
        config = yaml.load(APP_YAML + """
builtins:
- appstats: on
""")
        target_info._ValidateConfig(config)
示例#34
0
    def testMimeTypeOnStaticDir(self):
        config = yaml.load(APP_YAML + """
  mime_type: text/plain; charset=utf-8
""")
        target_info._ValidateConfig(config)
示例#35
0
 def testWSGIScript(self):
   config = yaml.load(APP_YAML)
   handler = {'url': '/', 'script': 'main.app'}
   config['handlers'] = [handler]
   target_info._ValidateConfig(config)
示例#36
0
    def testBuiltinAdminRedirect(self):
        config = yaml.load(APP_YAML + """
builtins:
- admin_redirect: on
""")
        target_info._ValidateConfig(config)