def test_name_collisions_pulling_properly(setup_name_collision, storage, tmpdir):
    storage.set_remote_base_path(NAME_COLLISIONS_DIR_NAME)
    local_base_dir = tmpdir.mkdir('remote_storage')
    colliding_file_name = 'file.txt.collision'
    colliding_dir_name = 'dir_name_collision'
    storage.pull('file.txt', local_base_dir=local_base_dir)
    storage.pull('dir_name', local_base_dir=local_base_dir)
    assert (not os.path.isfile(os.path.join(local_base_dir, colliding_file_name)))
    assert os.path.isfile(os.path.join(local_base_dir, 'file.txt'))
    assert (not os.path.isdir(os.path.join(local_base_dir, colliding_dir_name)))
    assert os.path.isdir(os.path.join(local_base_dir, 'dir_name'))
    storage.pull(colliding_file_name, local_base_dir=local_base_dir)
    assert os.path.isfile(os.path.join(local_base_dir, colliding_file_name))
    storage.pull(colliding_dir_name, local_base_dir=local_base_dir)
    assert os.path.isfile(os.path.join(local_base_dir, colliding_dir_name, 'file.txt'))
def test_name_collisions_pulling_properly(setup_name_collision, storage, tmpdir):
    storage.set_remote_base_path(NAME_COLLISIONS_DIR_NAME)
    local_base_dir = tmpdir.mkdir('remote_storage')
    colliding_file_name = 'file.txt.collision'
    colliding_dir_name = 'dir_name_collision'
    storage.pull('file.txt', local_base_dir=local_base_dir)
    storage.pull('dir_name', local_base_dir=local_base_dir)
    assert (not os.path.isfile(os.path.join(local_base_dir, colliding_file_name)))
    assert os.path.isfile(os.path.join(local_base_dir, 'file.txt'))
    assert (not os.path.isdir(os.path.join(local_base_dir, colliding_dir_name)))
    assert os.path.isdir(os.path.join(local_base_dir, 'dir_name'))
    storage.pull(colliding_file_name, local_base_dir=local_base_dir)
    assert os.path.isfile(os.path.join(local_base_dir, colliding_file_name))
    storage.pull(colliding_dir_name, local_base_dir=local_base_dir)
    assert os.path.isfile(os.path.join(local_base_dir, colliding_dir_name, 'file.txt'))