Esempio n. 1
0
def test_path_components_with_trailing_slash():
    """ Trailing or leading slashes don't affect the result """
    path = '/202/ab6/2b5/51f/6d7/fc0/02f/656/525/255/44/'.replace('/', os.sep)
    expected = ['202', 'ab6', '2b5', '51f', '6d7', 'fc0', '02f', '656', '525',
                '255', '44']
    assert mod.content_path_components(path) == expected
Esempio n. 2
0
def test_path_components_with_path():
    """ Able to split paths into components """
    path = '202/ab6/2b5/51f/6d7/fc0/02f/656/525/255/44'.replace('/', os.sep)
    expected = ['202', 'ab6', '2b5', '51f', '6d7', 'fc0', '02f', '656', '525',
                '255', '44']
    assert mod.content_path_components(path) == expected
Esempio n. 3
0
def test_path_components():
    """ Path components shold be in groups of 3 characters except last one """
    md5 = '202ab62b551f6d7fc002f65652525544'
    expected = ['202', 'ab6', '2b5', '51f', '6d7', 'fc0', '02f', '656', '525',
                '255', '44']
    assert mod.content_path_components(md5) == expected
Esempio n. 4
0
def test_path_components_with_broken_id():
    """ For broken IDs, no path component should be returned """
    md5 = '202ab$$$62b551f6d7fc002f65652525544'
    assert mod.content_path_components(md5) == []
Esempio n. 5
0
def test_path_components_with_bogus_path():
    """ For invalid paths, no components should be returned """
    path = 'foo/bar/baz'
    assert mod.content_path_components(path) == []