コード例 #1
0
ファイル: test_filescheme.py プロジェクト: mehak/qutebrowser
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))
コード例 #2
0
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))
コード例 #3
0
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')
コード例 #4
0
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')
コード例 #5
0
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
コード例 #6
0
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
コード例 #7
0
 def file_url(self):
     """Return a file:// link to the directory."""
     return urlutils.file_url(str(self.layout))
コード例 #8
0
 def file_url(self):
     """Return a file:// link to the directory."""
     return urlutils.file_url(str(self.layout))
コード例 #9
0
def test_file_url():
    assert urlutils.file_url('/foo/bar') == 'file:///foo/bar'
コード例 #10
0
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
コード例 #11
0
def test_file_url():
    assert urlutils.file_url('/foo/bar') == 'file:///foo/bar'