How to use the buku.browse function in buku

To help you get started, we’ve selected a few buku examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jarun / Buku / tests / test_buku.py View on Github external
['example.com', 'http://example.com', 'linux'],
        ['http://example.com', 'http://example.com', 'win32'],
    ]
)
def test_browse(url, opened_url, platform):
    """test func."""
    with mock.patch('buku.webbrowser') as m_webbrowser, \
            mock.patch('buku.sys') as m_sys, \
            mock.patch('buku.os'):
        m_sys.platform = platform
        get_func_retval = mock.Mock()
        m_webbrowser.get.return_value = get_func_retval
        import buku
        buku.browse.suppress_browser_output = True
        buku.browse.override_text_browser = False
        buku.browse(url)
        if platform == 'win32':
            m_webbrowser.open.assert_called_once_with(opened_url, new=2)
        else:
            get_func_retval.open.assert_called_once_with(opened_url, new=2)
github jarun / Buku / tests / test_buku.py View on Github external
[
        ['http://example.com', 'http://example.com', 'linux'],
        ['example.com', 'http://example.com', 'linux'],
        ['http://example.com', 'http://example.com', 'win32'],
    ]
)
def test_browse(url, opened_url, platform):
    """test func."""
    with mock.patch('buku.webbrowser') as m_webbrowser, \
            mock.patch('buku.sys') as m_sys, \
            mock.patch('buku.os'):
        m_sys.platform = platform
        get_func_retval = mock.Mock()
        m_webbrowser.get.return_value = get_func_retval
        import buku
        buku.browse.suppress_browser_output = True
        buku.browse.override_text_browser = False
        buku.browse(url)
        if platform == 'win32':
            m_webbrowser.open.assert_called_once_with(opened_url, new=2)
        else:
            get_func_retval.open.assert_called_once_with(opened_url, new=2)
github jarun / Buku / tests / test_buku.py View on Github external
['http://example.com', 'http://example.com', 'linux'],
        ['example.com', 'http://example.com', 'linux'],
        ['http://example.com', 'http://example.com', 'win32'],
    ]
)
def test_browse(url, opened_url, platform):
    """test func."""
    with mock.patch('buku.webbrowser') as m_webbrowser, \
            mock.patch('buku.sys') as m_sys, \
            mock.patch('buku.os'):
        m_sys.platform = platform
        get_func_retval = mock.Mock()
        m_webbrowser.get.return_value = get_func_retval
        import buku
        buku.browse.suppress_browser_output = True
        buku.browse.override_text_browser = False
        buku.browse(url)
        if platform == 'win32':
            m_webbrowser.open.assert_called_once_with(opened_url, new=2)
        else:
            get_func_retval.open.assert_called_once_with(opened_url, new=2)