def _file_url(path): """Return a file:// url (as string) for the given LocalPath. Arguments: path: The filepath as LocalPath (as handled by py.path) """ return urlutils.file_url(str(path))
def test_enter_folder_smoke(dir_layout, quteproc): quteproc.open_url(dir_layout.file_url()) quteproc.send_cmd(':hint all normal') # a is the parent link, s is the first listed folder/file quteproc.send_cmd(':follow-hint s') expected_url = urlutils.file_url(dir_layout.path('folder0')) quteproc.wait_for_load_finished_url(expected_url) page = parse(quteproc) assert page.path == dir_layout.path('folder0')
def test_enter_folder(dir_layout, quteproc, folder): quteproc.open_url(dir_layout.file_url()) quteproc.click_element_by_text(text=folder) expected_url = urlutils.file_url(dir_layout.path(folder)) quteproc.wait_for_load_finished_url(expected_url) page = parse(quteproc) assert page.path == dir_layout.path(folder) assert page.parent == dir_layout.path() folders, files = DirLayout.get_folder_content(folder) foldernames = [item.text for item in page.folders] assert foldernames == folders filenames = [item.text for item in page.files] assert filenames == files
def file_url(self): """Return a file:// link to the directory.""" return urlutils.file_url(str(self.layout))
def test_file_url(): assert urlutils.file_url('/foo/bar') == 'file:///foo/bar'
def test_parent_in_root_dir(dir_layout, quteproc): # This actually works on windows urlstr = urlutils.file_url(str(pathlib.Path('/'))) quteproc.open_url(urlstr) page = parse(quteproc) assert page.parent is None