Пример #1
0
    def __call__(self, path='/', *a):
        """Given an URL path, return 

        This only allows you to simulate GET requests with no querystring, so
        it's limited. But it's a something. Kind of. Almost.

        """
        website = Website(self.argv + list(a))
        request = StubRequest(path)
        request.website = website
        response = website.handle(request)
        return response
Пример #2
0
def handle(path='/'):
    website = Website(['fsfix'])
    request = StubRequest(path)
    request.website = website
    response = website.handle(request)
    return response
Пример #3
0
       )
    expected = "Greetings, baz!"
    actual = handle('/', '--project_root=.aspen').body
    assert actual == expected, actual


def test_double_failure_still_sets_response_dot_request():
    mk( '.aspen'
      , ('.aspen/foo.py', """
def bar(response):
    response.request
""")
      , ( '.aspen/configure-aspen.py'
        , 'import foo\nwebsite.hooks.outbound_late.register(foo.bar)'
         )
      , ('index.html', "raise heck")
       )

    # Intentionally break the website object so as to trigger a double failure.
    website = Website(['--www_root='+FSFIX, '--project_root=.aspen'])
    del website.renderer_factories

    response = website.handle(StubRequest())

    expected = 500
    actual = response.code
    assert actual == expected, actual


attach_teardown(globals())
Пример #4
0
def handle(path):
    website = Website(Configuration(['fsfix']))
    return website.handle(Request.from_diesel(DieselReq(path)))
Пример #5
0
def handle(path):
    website = Website(Configuration(['fsfix']))
    return website.handle(Request.from_diesel(DieselReq(path)))
Пример #6
0
def check():
    website = Website(Configuration(['fsfix']))
    response = website.handle(Request.from_diesel(DieselReq()))
    return response