예제 #1
0
def test_new_base_route():
    # note default slashing behavior
    rp = BaseRoute('/a/b/<t:int>/thing/<das+int>')
    d = rp.match_path('/a/b/1/thing/1/2/3/4')
    yield eq_, d, {u't': 1, u'das': [1, 2, 3, 4]}

    d = rp.match_path('/a/b/1/thing/hi/')
    yield eq_, d, None

    d = rp.match_path('/a/b/1/thing/')
    yield eq_, d, None

    rp = BaseRoute('/a/b/<t:int>/thing/<das*int>', methods=['GET'])
    d = rp.match_path('/a/b/1/thing')
    yield eq_, d, {u't': 1, u'das': []}
예제 #2
0
def test_new_base_route():
    # note default slashing behavior
    rp = BaseRoute('/a/b/<t:int>/thing/<das+int>')
    d = rp.match_path('/a/b/1/thing/1/2/3/4')
    yield eq_, d, {u't': 1, u'das': [1, 2, 3, 4]}

    d = rp.match_path('/a/b/1/thing/hi/')
    yield eq_, d, None

    d = rp.match_path('/a/b/1/thing/')
    yield eq_, d, None

    rp = BaseRoute('/a/b/<t:int>/thing/<das*int>', methods=['GET'])
    d = rp.match_path('/a/b/1/thing')
    yield eq_, d, {u't': 1, u'das': []}
예제 #3
0
def test_base_route_executes():
    br = BaseRoute('/', lambda request: request['stephen'])
    res = br.execute({'stephen': 'laporte'})
    yield eq_, res, 'laporte'
예제 #4
0
def test_base_application_basics():
    br = BaseRoute('/', lambda request: BaseResponse('lolporte'))
    ba = BaseApplication([br])
    client = Client(ba, BaseResponse)
    res = client.get('/')
    yield eq_, res.data, 'lolporte'
예제 #5
0
def test_base_route_raises_on_no_ep():
    BaseRoute('/a/b/<t:int>/thing/<das+int>').execute({})
예제 #6
0
def test_base_route_executes():
    br = BaseRoute('/', lambda request: request['stephen'])
    res = br.execute({'stephen': 'laporte'})
    yield eq_, res, 'laporte'
예제 #7
0
def test_base_route_executes():
    br = BaseRoute('/', lambda request: request['stephen'])
    res = br.execute({'stephen': 'laporte'})
    assert res == 'laporte'