コード例 #1
0
ファイル: test_links.py プロジェクト: mwilliamson/mash
def test_find_path_in_tree_will_convert_path_ending_in_index_html_to_directory():
    tree = {
        "url": "/",
        "children": [
            {
                "url": "/projects/",
                "children": [
                    {"url": "/projects/funk/"},
                    {"url": "/projects/zuice/"}
                ]
            },
            {"url": "/blog/"}
        ]
    }
    assert_equals([0, 0, 1], find_path_in_tree(tree, "/projects/zuice/index.html"))
コード例 #2
0
ファイル: test_links.py プロジェクト: mwilliamson/mash
def test_find_path_in_tree_returns_list_of_indices_to_path():
    tree = {
        "url": "/",
        "children": [
            {
                "url": "/projects/",
                "children": [
                    {"url": "/projects/funk/"},
                    {"url": "/projects/zuice/"}
                ]
            },
            {"url": "/blog/"}
        ]
    }
    assert_equals([0, 0, 1], find_path_in_tree(tree, "/projects/zuice/"))
コード例 #3
0
ファイル: test_links.py プロジェクト: mwilliamson/mash
def test_find_path_in_tree_returns_singleton_of_zero_for_root_path():
    tree = {
        "url": "/",
        "children": [
            {
                "url": "/projects/",
                "children": [
                    {"url": "/projects/funk/"},
                    {"url": "/projects/zuice/"}
                ]
            },
            {"url": "/blog/"}
        ]
    }
    assert_equals([0], find_path_in_tree(tree, "/"))
コード例 #4
0
ファイル: test_links.py プロジェクト: mwilliamson/mash
def test_find_path_in_tree_returns_none_if_path_not_in_tree():
    tree = {
        "url": "/",
        "children": [
            {
                "url": "/projects/",
                "children": [
                    {"url": "/projects/funk/"},
                    {"url": "/projects/zuice/"}
                ]
            },
            {"url": "/blog/"}
        ]
    }
    assert_equals(None, find_path_in_tree(tree, "/contact/"))