def test_traverse_root_with_tail(loop, router, request):
    request.path = '/not/c'

    res, tail = loop.run_until_complete(router.traverse(request))

    assert tail == ('not', 'c')
    assert len(list(lineage(res))) == 1
    assert find_root(res).name == 'ROOT'
def test_traverse_root_with_tail(loop, router, request):
    request.path = '/not/c'

    res, tail = loop.run_until_complete(router.traverse(request))

    assert tail == ('not', 'c')
    assert len(list(lineage(res))) == 1
    assert find_root(res).name == 'ROOT'
def test_traverse(loop, router, request):
    request.path = '/a/b/c'

    res, tail = loop.run_until_complete(router.traverse(request))

    assert res.name == 'c'
    assert not tail
    assert len(list(lineage(res))) == 4
    assert find_root(res).name == 'ROOT'
def test_traverse_root(loop, router, request):
    request.path = '/'

    res, tail = loop.run_until_complete(router.traverse(request))

    assert tail == ()
    assert len(list(lineage(res))) == 1
    assert find_root(res) is res
    assert res.name == 'ROOT'
def test_traverse(loop, router, request):
    request.path = '/a/b/c'

    res, tail = loop.run_until_complete(router.traverse(request))

    assert res.name == 'c'
    assert not tail
    assert len(list(lineage(res))) == 4
    assert find_root(res).name == 'ROOT'
def test_traverse_root(loop, router, request):
    request.path = '/'

    res, tail = loop.run_until_complete(router.traverse(request))

    assert tail == ()
    assert len(list(lineage(res))) == 1
    assert find_root(res) is res
    assert res.name == 'ROOT'
Exemple #7
0
def test_find_root(root, res_c):
    assert find_root(res_c) is root