def test_launch_darwin(self): with mock.patch("quicksearch.launch.subprocess") as subprocess_mocked: subprocess_mocked.Popen = mock.MagicMock() with mock.patch("quicksearch.launch.sys.platform", "darwin"): open("http://example.com/") subprocess_mocked.Popen.assert_called_once_with(["open", "http://example.com/"])
def test_launch_win(self): with mock.patch("quicksearch.launch.os") as os_mocked: os_mocked.startfile = mock.MagicMock() with mock.patch("quicksearch.launch.sys.platform", "win32"): open("http://example.com/") os_mocked.startfile.assert_called_once_with("http://example.com/")