예제 #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)