Exemplo n.º 1
0
    def test_fallback_isolation(self):
        import webbrowser

        with mock.patch.multiple("dallinger.deployment",
                                 is_command=mock.DEFAULT,
                                 sys=mock.DEFAULT) as patches:
            patches["is_command"].return_value = False
            patches["sys"].platform = 'anything but "darwin"'
            isolated = new_webbrowser_profile()
        assert isolated == webbrowser
Exemplo n.º 2
0
    def test_chrome_isolation(self):
        import webbrowser

        with mock.patch("dallinger.deployment.is_command") as is_command:
            is_command.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[-2].startswith(
            '--user-data-dir="{}'.format(tempfile.gettempdir()))
        assert isolated.remote_args[-1] == r"--no-first-run"
Exemplo n.º 3
0
    def test_firefox_isolation(self):
        import webbrowser

        with mock.patch("dallinger.deployment.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",
        ]