def test_fallback_isolation(self):
     import webbrowser
     with mock.patch(
             'dallinger.command_line.webbrowser._iscommand') as _iscommand:
         _iscommand.return_value = False
         isolated = new_webbrowser_profile()
     assert isolated == webbrowser
 def test_chrome_isolation(self):
     import webbrowser
     with mock.patch(
             'dallinger.command_line.webbrowser._iscommand') as _iscommand:
         _iscommand.side_effect = lambda s: s == 'google-chrome'
         isolated = new_webbrowser_profile()
     assert isinstance(isolated, webbrowser.Chrome)
     assert isolated.remote_args[:2] == [r'%action', r'%s']
     assert isolated.remote_args[-1].startswith('--user-data-dir="/tmp')
 def test_firefox_isolation(self):
     import webbrowser
     with mock.patch('dallinger.command_line.is_command') as is_command:
         is_command.side_effect = lambda s: s == 'firefox'
         isolated = new_webbrowser_profile()
     assert isinstance(isolated, webbrowser.Mozilla)
     assert isolated.remote_args[0] == '-profile'
     assert isolated.remote_args[1].startswith(tempfile.gettempdir())
     assert isolated.remote_args[2:] == ['-new-instance', '-no-remote', '-url', r'%s']