Exemple #1
0
def test_prefixes_are_always_normalized():
    """
    Regardless of the type of slash used in prefix, correct ones are always
    used in the output
    """
    md5 = '202ab62b551f6d7fc002f65652525544'
    path = '/srv/zipballs/202/ab6/2b5/51f/6d7/fc0/02f/656/525/255/44'.replace(
        '/', os.sep)
    assert mod.to_path(md5, prefix='\\srv\\zipballs') == path
    assert mod.to_path(md5, prefix='/srv/zipballs') == path
Exemple #2
0
def test_convert_to_path_with_bad_id():
    """ For broken ID, empty string is returned """
    md5 = '202ab$$$62b551f6d7fc002f65652525544'
    assert mod.to_path(md5) is None
    assert mod.to_path(md5, prefix='/some/path/') is None
Exemple #3
0
def test_convert_to_path_with_prefix():
    """ For given id and prefix, a prefixed path is gnerated """
    md5 = '202ab62b551f6d7fc002f65652525544'
    path = '/srv/zipballs/202/ab6/2b5/51f/6d7/fc0/02f/656/525/255/44'.replace(
        '/', os.sep)
    assert mod.to_path(md5, prefix='/srv/zipballs') == path
Exemple #4
0
def test_conversion_to_path():
    """ For given ID, a valid path should be produced """
    md5 = '202ab62b551f6d7fc002f65652525544'
    path = '202/ab6/2b5/51f/6d7/fc0/02f/656/525/255/44'.replace('/', os.sep)
    assert mod.to_path(md5) == path