示例#1
0
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()
示例#2
0
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()
示例#3
0
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
示例#4
0
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
示例#5
0
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()
示例#6
0
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()
示例#7
0
def test_autostart_enable(tmpfile, monkeypatch):
    monkeypatch.setattr('gridsync.desktop.autostart_file_path', tmpfile)
    autostart_enable()
    assert autostart_is_enabled()
示例#8
0
 def on_checkbox_autostart_changed(state):
     if state:
         autostart_enable()
     else:
         autostart_disable()
示例#9
0
 def on_checkbox_autostart_changed(self, state):  # pylint:disable=no-self-use
     if state:
         autostart_enable()
     else:
         autostart_disable()
示例#10
0
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()