def test_autostart_enable_windows(tmpfile, monkeypatch): monkeypatch.setattr('sys.platform', 'win32') monkeypatch.setattr('gridsync.desktop.Dispatch', Mock(), raising=False) monkeypatch.setattr('gridsync.desktop.autostart_file_path', tmpfile) autostart_enable() with open(tmpfile, 'a'): os.utime(tmpfile, None) assert autostart_is_enabled()
def test_autostart_enable_windows(tmpfile, monkeypatch): monkeypatch.setattr("sys.platform", "win32") monkeypatch.setattr("gridsync.desktop.Dispatch", Mock(), raising=False) monkeypatch.setattr("gridsync.desktop.autostart_file_path", tmpfile) autostart_enable() with open(tmpfile, "a"): os.utime(tmpfile, None) assert autostart_is_enabled()
def test_autostart_enable_appimage(tmpfile, monkeypatch): monkeypatch.setattr('sys.platform', 'linux') monkeypatch.setattr('gridsync.desktop.autostart_file_path', tmpfile) appimage = '/test/gridsync.AppImage' monkeypatch.setattr('os.environ', {'PATH': '/tmp', 'APPIMAGE': appimage}) m = Mock() monkeypatch.setattr('gridsync.desktop._autostart_enable_linux', m) autostart_enable() assert m.call_args[0][0] == appimage
def test_autostart_enable_appimage(tmpfile, monkeypatch): monkeypatch.setattr("sys.platform", "linux") monkeypatch.setattr("gridsync.desktop.autostart_file_path", tmpfile) appimage = "/test/gridsync.AppImage" monkeypatch.setattr("os.environ", {"PATH": "/tmp", "APPIMAGE": appimage}) m = Mock() monkeypatch.setattr("gridsync.desktop._autostart_enable_linux", m) autostart_enable() assert m.call_args[0][0] == appimage
def test_autostart_enable_mac(tmpfile, monkeypatch): monkeypatch.setattr('sys.platform', 'darwin') monkeypatch.setattr('gridsync.desktop.autostart_file_path', tmpfile) autostart_enable() assert autostart_is_enabled()
def test_autostart_enable_frozen(tmpfile, monkeypatch): monkeypatch.setattr("sys.frozen", True, raising=False) monkeypatch.setattr('gridsync.desktop.autostart_file_path', tmpfile) autostart_enable() assert autostart_is_enabled()
def test_autostart_enable(tmpfile, monkeypatch): monkeypatch.setattr('gridsync.desktop.autostart_file_path', tmpfile) autostart_enable() assert autostart_is_enabled()
def on_checkbox_autostart_changed(state): if state: autostart_enable() else: autostart_disable()
def on_checkbox_autostart_changed(self, state): # pylint:disable=no-self-use if state: autostart_enable() else: autostart_disable()
def test_autostart_enable_mac(tmpfile, monkeypatch): monkeypatch.setattr("sys.platform", "darwin") monkeypatch.setattr("gridsync.desktop.autostart_file_path", tmpfile) autostart_enable() assert autostart_is_enabled()