Beispiel #1
0
    def test_environment_load_regular(self):
        """
		Test to make sure the tests file was loaded successfully
		"""
        test_conf = yaml.load(resource_stream("example", "conf/test.yaml"))
        env = Environment("example")
        assert env.config['test'] == test_conf
Beispiel #2
0
def set_env(name, conf=None):
    from botoweb.environment import Environment
    env = Environment(name, conf)
    import boto
    boto.config = env.config
    import botoweb
    botoweb.env = env
    return env
Beispiel #3
0
    def test_environment_load_special(self):
        """
		Load up a special environment file
		and make sure the overrides apply
		"""
        env = Environment("example", "test")
        assert env.config['test']['test_bool'] == False
        assert env.config['app']['name'] == "Test App"
Beispiel #4
0
 def setup_class(cls):
     """Setup this class"""
     import sys
     sys.path.append(".")
     sys.path.append("../")
     env = Environment("example")
     cls.handler = DBHandler(
         env,
         config={"db_class": "%s.SimpleObject" % SimpleObject.__module__})
Beispiel #5
0
    def setup_class(cls):
        """
		Setup this class
		"""
        cls.env = Environment("example")
        cls.url_mapper = URLMapper(cls.env)
        cls.env.config['botoweb']['handlers'] = [{
            "url":
            "/foo",
            "handler":
            "%s.SimpleHandler" % cls.__module__
        }]
Beispiel #6
0
def set_env(name, conf=None):
    from botoweb.environment import Environment
    env = Environment(name, conf)
    import boto
    boto.config = env.config
    import botoweb
    botoweb.env = env

    set_user_class()
    set_cache()

    return env
Beispiel #7
0
    def __init__(self):
        """
		Setup this class to handle testing
		"""
        import boto
        from botoweb.environment import Environment
        e = Environment(self.application)
        self.env = e
        boto.config = self.env.config

        from botoweb.appserver.url_mapper import URLMapper
        from botoweb.appserver.filter_mapper import FilterMapper
        from botoweb.appserver.auth_layer import AuthLayer

        self.mapper = AuthLayer(app=FilterMapper(app=URLMapper(e), env=e),
                                env=e)
Beispiel #8
0
def start(app, env=None, port=8080, hostname="localhost"):
    """
	Start up a server hosting this application
	Optionally, you can pass in the name of the environment
	file relative to this application
	"""
    from botoweb.environment import Environment
    e = Environment(app, env)
    import boto
    boto.config = e.config
    from paste import httpserver
    from botoweb.appserver.url_mapper import URLMapper
    from botoweb.appserver.filter_mapper import FilterMapper
    mapper = FilterMapper(app=URLMapper(e), env=e)

    httpserver.serve(mapper, host=hostname, port=int(port))