示例#1
0
 def setUp(self):
   s = LazySettings(settings_module='kay.tests.regressiontests.badurls_settings')
   self.app = get_application(settings=s)
   try:
       self.client = Client(self.app, BaseResponse)
   except DeadlineExceededError:
       pass
示例#2
0
 def setUp(self):
     init_recording()
     app = get_application()
     self.client = Client(app, BaseResponse)
     self.consumer_key = "e30e49d63907db14c48c5ad063ff7577b7ab5248"
     self.consumer_secret = "d06b6c54863ac33d12419dd04f7acb85c696f722"
     self.access_token = "c02b74809aaccf4972b9bb7059fa28aa91a255a3"
     self.access_token_secret = "9c676e003b8932ac49d4d3a18467c0b59e3e3fb6"
示例#3
0
 def setUp(self):
   s = LazySettings(settings_module='kay.tests.settings')
   app = get_application(settings=s)
   self.client = Client(app, BaseResponse)
   if apiproxy_stub_map.apiproxy\
         ._APIProxyStubMap__stub_map.has_key('capability_service'):
     del(apiproxy_stub_map.apiproxy\
           ._APIProxyStubMap__stub_map['capability_service'])
示例#4
0
 def setUp(self):
     s = LazySettings(
         settings_module='kay.tests.regressiontests.badurls_settings')
     self.app = get_application(settings=s)
     try:
         self.client = Client(self.app, BaseResponse)
     except DeadlineExceededError:
         pass
示例#5
0
    def setUp(self):
        from google.appengine.api import memcache
        memcache.flush_all()
        s = LazySettings(settings_module='kay.tests.live_settings_settings')
        app = get_application(settings=s)
        self.client = Client(app, BaseResponse)

        live_settings.set("setting.1", "on")
        live_settings.set("setting.2", "off")
示例#6
0
  def setUp(self):
    from google.appengine.api import memcache
    memcache.flush_all()
    s = LazySettings(settings_module='kay.tests.live_settings_settings')
    app = get_application(settings=s)
    self.client = Client(app, BaseResponse)

    live_settings.set("setting.1", "on")
    live_settings.set("setting.2", "off")
    def setUp(self):
        s = LazySettings(settings_module="kay.tests.regressiontests.server_error_settings")
        app = get_application(settings=s)
        self.client = Client(app, BaseResponse)
        self.client.test_logout()

        # Suppress logging error messages
        self._base_logger = logging.getLogger("")
        self._old_logging_handlers = self._base_logger.handlers
        self._base_logger.handlers = [NullHandler()]
示例#8
0
    def setUp(self):
        s = LazySettings(
            settings_module='kay.tests.regressiontests.server_error_settings')
        app = get_application(settings=s)
        self.client = Client(app, BaseResponse)
        self.client.test_logout()

        # Suppress logging error messages
        self._base_logger = logging.getLogger("")
        self._old_logging_handlers = self._base_logger.handlers
        self._base_logger.handlers = [NullHandler()]
示例#9
0
文件: auth_test.py 项目: IanLewis/kay
 def setUp(self):
   try:
     self.original_user = os.environ['USER_EMAIL']
     self.original_is_admin = os.environ['USER_IS_ADMIN']
     del os.environ['USER_EMAIL']
     del os.environ['USER_IS_ADMIN']
   except Exception:
     pass
   s = LazySettings(settings_module='kay.tests.google_settings')
   app = get_application(settings=s)
   self.client = Client(app, BaseResponse)
   self.client.test_logout()
示例#10
0
 def setUp(self):
     try:
         self.original_user = os.environ['USER_EMAIL']
         self.original_is_admin = os.environ['USER_IS_ADMIN']
         del os.environ['USER_EMAIL']
         del os.environ['USER_IS_ADMIN']
     except Exception:
         pass
     s = LazySettings(settings_module='kay.tests.google_settings')
     app = get_application(settings=s)
     self.client = Client(app, BaseResponse)
     self.client.test_logout()
示例#11
0
  def setUp(self):
    s = LazySettings(
      settings_module='kay.tests.ereporter_settings')
    app = get_application(settings=s)
    self.client = Client(app, BaseResponse)
    #self.client.test_logout()

    # Suppress logging error messages
    self._base_logger = logging.getLogger("")
    self._old_logging_handlers = self._base_logger.handlers
    self._base_logger.handlers = filter(
        lambda h: not isinstance(h, logging.StreamHandler),
        self._old_logging_handlers,
    ) 
示例#12
0
    def setUp(self):
        apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()
        stub = datastore_file_stub.DatastoreFileStub("test", "/dev/null", "/dev/null")
        apiproxy_stub_map.apiproxy.RegisterStub("datastore_v3", stub)

        apiproxy_stub_map.apiproxy.RegisterStub("user", user_service_stub.UserServiceStub())

        apiproxy_stub_map.apiproxy.RegisterStub("memcache", memcache_stub.MemcacheServiceStub())

        apiproxy_stub_map.apiproxy.RegisterStub("urlfetch", urlfetch_stub.URLFetchServiceStub())

        s = LazySettings(settings_module="kay.tests.settings")
        app = get_application(settings=s)
        self.client = Client(app, BaseResponse)
        if apiproxy_stub_map.apiproxy._APIProxyStubMap__stub_map.has_key("capability_service"):
            del (apiproxy_stub_map.apiproxy._APIProxyStubMap__stub_map["capability_service"])
示例#13
0
def real_main():
    global application
    global applications
    server_name = os.environ.get('SERVER_NAME')
    target_setting = settings.PER_DOMAIN_SETTINGS.get(server_name, None)
    if target_setting:
        applications[server_name] = get_application(settings=LazySettings(
            settings_module=target_setting))
    if settings.DEBUG:
        logging.getLogger().setLevel(logging.DEBUG)
        if 'SERVER_SOFTWARE' in os.environ and \
              os.environ['SERVER_SOFTWARE'].startswith('Dev'):
            # use our debug.utils with Jinja2 templates
            import debug.utils
            sys.modules['werkzeug.debug.utils'] = debug.utils

            # don't use inspect.getsourcefile because the imp module is empty
            import inspect
            inspect.getsourcefile = inspect.getfile

            # wrap the application
            from werkzeug import DebuggedApplication
            global debugged_application
            global debugged_applications
            if target_setting:
                if not debugged_applications.has_key(server_name):
                    debugged_applications[server_name] = applications[server_name] = \
                        DebuggedApplication(applications[server_name], evalex=True)
                else:
                    applications[server_name] = debugged_applications[
                        server_name]
            else:
                if debugged_application is None:
                    debugged_application = application = DebuggedApplication(
                        application, evalex=True)
                else:
                    application = debugged_application
    else:
        logging.getLogger().setLevel(logging.INFO)
    if target_setting:
        KayHandler().run(applications[server_name])
    else:
        KayHandler().run(application)
示例#14
0
def real_main():
  global application
  global applications
  server_name = os.environ.get('SERVER_NAME')
  target_setting = settings.PER_DOMAIN_SETTINGS.get(server_name, None)
  if target_setting:
    applications[server_name] = get_application(
      settings=LazySettings(settings_module=target_setting))
  if settings.DEBUG:
    logging.getLogger().setLevel(logging.DEBUG)
    if 'SERVER_SOFTWARE' in os.environ and \
          os.environ['SERVER_SOFTWARE'].startswith('Dev'):
      # use our debug.utils with Jinja2 templates
      import debug.utils
      sys.modules['werkzeug.debug.utils'] = debug.utils

      # don't use inspect.getsourcefile because the imp module is empty 
      import inspect
      inspect.getsourcefile = inspect.getfile
    
      # wrap the application
      from werkzeug import DebuggedApplication
      global debugged_application
      global debugged_applications
      if target_setting:
        if not debugged_applications.has_key(server_name):
          debugged_applications[server_name] = applications[server_name] = \
              DebuggedApplication(applications[server_name], evalex=True)
        else:
          applications[server_name] = debugged_applications[server_name]
      else:
        if debugged_application is None:
          debugged_application = application = DebuggedApplication(application,
                                                                   evalex=True)
        else:
          application = debugged_application
  else:
    logging.getLogger().setLevel(logging.INFO)
  if target_setting:
    KayHandler().run(applications[server_name])
  else:
    KayHandler().run(application)
示例#15
0
    def setUp(self):
        app = get_application()
        self.client = Client(app, BaseResponse)

        self.test_values = {
            'date': datetime.datetime(2016, 5, 20, 15, 0),
            'title': 'THIS IS TITLE',
            'description': 'THIS IS TITLE',
        }

        eve = Event(
            event_date=self.test_values['date'],
            title=self.test_values['title'],
            description=self.test_values['description'],
        )
        eve.put()
        events = Event.all().fetch(100)
        self.assertEquals(len(events), 1)
        self.assertEquals(events[0].title, 'THIS IS TITLE')
        self.event_key = str(events[0].key())
示例#16
0
    def setUp(self):
        apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()
        stub = datastore_file_stub.DatastoreFileStub('test', '/dev/null',
                                                     '/dev/null')
        apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', stub)

        apiproxy_stub_map.apiproxy.RegisterStub(
            'user', user_service_stub.UserServiceStub())

        apiproxy_stub_map.apiproxy.RegisterStub(
            'memcache', memcache_stub.MemcacheServiceStub())

        apiproxy_stub_map.apiproxy.RegisterStub(
            'urlfetch', urlfetch_stub.URLFetchServiceStub())

        s = LazySettings(settings_module='kay.tests.settings')
        app = get_application(settings=s)
        self.client = Client(app, BaseResponse)
        if apiproxy_stub_map.apiproxy\
              ._APIProxyStubMap__stub_map.has_key('capability_service'):
            del(apiproxy_stub_map.apiproxy\
                  ._APIProxyStubMap__stub_map['capability_service'])
示例#17
0
  def setUp(self):
    apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()
    stub = datastore_file_stub.DatastoreFileStub('test','/dev/null',
                                                 '/dev/null')
    apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', stub)

    apiproxy_stub_map.apiproxy.RegisterStub(
      'user', user_service_stub.UserServiceStub())

    apiproxy_stub_map.apiproxy.RegisterStub(
      'memcache', memcache_stub.MemcacheServiceStub())

    apiproxy_stub_map.apiproxy.RegisterStub(
      'urlfetch', urlfetch_stub.URLFetchServiceStub())

    s = LazySettings(settings_module='kay.tests.settings')
    app = get_application(settings=s)
    self.client = Client(app, BaseResponse)
    if apiproxy_stub_map.apiproxy\
          ._APIProxyStubMap__stub_map.has_key('capability_service'):
      del(apiproxy_stub_map.apiproxy\
            ._APIProxyStubMap__stub_map['capability_service'])
示例#18
0
 def setUp(self):
   from google.appengine.api import memcache
   memcache.flush_all()
   s = LazySettings(settings_module='kay.tests.appstats_settings')
   app = get_application(settings=s)
   self.client = Client(app, BaseResponse)
示例#19
0
文件: auth_test.py 项目: IanLewis/kay
 def setUp(self):
   from kay.auth import create_new_user
   s = LazySettings(settings_module='kay.tests.datastore_settings')
   app = get_application(settings=s)
   self.client = Client(app, BaseResponse)
   create_new_user("foobar", "password", is_admin=False)
示例#20
0
 def setUp(self):
   s = LazySettings(settings_module='kay.tests.decorator_settings')
   s.DEBUG = True
   app = get_application(settings=s)
   self.client = Client(app, BaseResponse)
示例#21
0
 def setUp(self):
   s = LazySettings(settings_module='kay.tests.settings')
   app = get_application(settings=s)
   self.client = Client(app, BaseResponse)
示例#22
0
"""

import logging
import os
import sys

sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dirname(__file__))))

import kay
kay.setup()

from kay.app import get_application
from kay.utils.handlers import KayHandler
from kay.conf import (settings, LazySettings)

application = get_application()
debugged_application = None
applications = {}
debugged_applications = {}


def real_main():
    global application
    global applications
    server_name = os.environ.get('SERVER_NAME')
    target_setting = settings.PER_DOMAIN_SETTINGS.get(server_name, None)
    if target_setting:
        applications[server_name] = get_application(settings=LazySettings(
            settings_module=target_setting))
    if settings.DEBUG:
        logging.getLogger().setLevel(logging.DEBUG)
示例#23
0
 def setUp(self):
     s = LazySettings(settings_module='kay.tests.google_settings')
     self.app = get_application(settings=s)
示例#24
0
 def setUp(self):
     init_recording()
     app = get_application()
     self.client = Client(app, BaseResponse)
     self.consumer_key = "3db2991a3bd1f2ca292a463744f4136d61b1faa3"
     self.consumer_secret = "ee49886656eacc1451a1a06ad61d7a8b31448650"
示例#25
0
 def setUp(self):
   s = LazySettings(settings_module='kay.tests.google_settings')
   self.app = get_application(settings=s)
示例#26
0
 def setUp(self):
     from google.appengine.api import memcache
     memcache.flush_all()
     s = LazySettings(settings_module='kay.tests.appstats_settings')
     app = get_application(settings=s)
     self.client = Client(app, BaseResponse)
示例#27
0
 def setUp(self):
     s = LazySettings(settings_module='kay.tests.cache_test.settings')
     self.app = get_application(settings=s)
     self.client = Client(self.app, BaseResponse)
     memcache.flush_all()
示例#28
0
 def setUp(self):
   import os
   s = LazySettings(settings_module='kay.tests.cookie_session_settings')
   app = get_application(settings=s)
   self.client = Client(app, BaseResponse)
   self.server_name = os.environ['SERVER_NAME']
示例#29
0
 def setUp(self):
     init_recording()
     app = get_application()
     self.client = Client(app, BaseResponse)
示例#30
0
 def setUp(self):
     import os
     s = LazySettings(settings_module='kay.tests.cookie_session_settings')
     app = get_application(settings=s)
     self.client = Client(app, BaseResponse)
     self.server_name = os.environ['SERVER_NAME']
示例#31
0
 def setUp(self):
     from kay.auth import create_new_user
     s = LazySettings(settings_module='kay.tests.datastore_settings')
     app = get_application(settings=s)
     self.client = Client(app, BaseResponse)
     create_new_user("foobar", "password", is_admin=False)
示例#32
0
"""

import logging
import os
import sys

import kay
kay.setup()

from kay.app import get_application
from kay.utils.handlers import KayHandler
from kay.conf import (
  settings, LazySettings
)

application = get_application()
debugged_application = None
applications = {}
debugged_applications = {}

def real_main():
  global application
  global applications
  server_name = os.environ.get('SERVER_NAME')
  target_setting = settings.PER_DOMAIN_SETTINGS.get(server_name, None)
  if target_setting:
    applications[server_name] = get_application(
      settings=LazySettings(settings_module=target_setting))
  if settings.DEBUG:
    logging.getLogger().setLevel(logging.DEBUG)
    if 'SERVER_SOFTWARE' in os.environ and \
示例#33
0
文件: tests.py 项目: dbordak/pyblog
 def setUp(self):
   s = LazySettings(settings_module='kay.tests.cache_test.settings')
   self.app = get_application(settings=s)
   self.client = Client(self.app, BaseResponse)
   memcache.flush_all()
示例#34
0
 def setUp(self):
   self.client = Client(get_application(), BaseResponse)
   self.c = self.client