Exemplo n.º 1
0
def test_growl_registration_exception(monkeypatch, mocker):
    monkeypatch.setattr('autosubliminal.NOTIFYGROWL', True)
    monkeypatch.setattr('autosubliminal.GROWLHOST', 'localhost')
    monkeypatch.setattr('autosubliminal.GROWLPORT', 23053)
    mocker.patch('gntp.notifier.GrowlNotifier.register', side_effect=Exception)
    notifier = GrowlNotifier()
    assert notifier.name == notifier_name
    assert notifier.test() is False
Exemplo n.º 2
0
def test_growl_notify_download(monkeypatch, mocker):
    monkeypatch.setattr('autosubliminal.NOTIFYGROWL', True)
    monkeypatch.setattr('autosubliminal.GROWLHOST', 'localhost')
    monkeypatch.setattr('autosubliminal.GROWLPORT', 23053)
    mocker.patch('gntp.notifier.GrowlNotifier.notify', return_value=True)
    notifier = GrowlNotifier()
    assert notifier.name == notifier_name
    assert notifier.notify_download(**item_dict) is True
Exemplo n.º 3
0
def test_growl_test(monkeypatch, mocker):
    monkeypatch.setattr('autosubliminal.NOTIFYGROWL', True)
    monkeypatch.setattr('autosubliminal.GROWLHOST', 'localhost')
    monkeypatch.setattr('autosubliminal.GROWLPORT', 23053)
    mocker.patch('gntp.notifier.GrowlNotifier.register', return_value=True)
    mocker.patch('gntp.notifier.GrowlNotifier.notify', return_value=True)
    notifier = GrowlNotifier()
    assert notifier.name == notifier_name
    assert notifier.test() is True
Exemplo n.º 4
0
def test_growl_error(monkeypatch, mocker):
    monkeypatch.setattr('autosubliminal.NOTIFYGROWL', True)
    monkeypatch.setattr('autosubliminal.GROWLHOST', 'localhost')
    monkeypatch.setattr('autosubliminal.GROWLPORT', 23053)
    mocker.patch('gntp.notifier.GrowlNotifier.notify', return_value=False)
    notifier = GrowlNotifier()
    assert notifier.name == notifier_name
    assert notifier.notify('test') is False
    assert notifier.notify_download(download_item) is False
Exemplo n.º 5
0
def test_growl_exception(monkeypatch, mocker):
    monkeypatch.setattr('autosubliminal.NOTIFYGROWL', True)
    monkeypatch.setattr('autosubliminal.GROWLHOST', 'localhost')
    monkeypatch.setattr('autosubliminal.GROWLPORT', 23053)
    # monkeypatch.setattr('gntp.notifier.GrowlNotifier.notify', Exception) # seems to work also
    mocker.patch('gntp.notifier.GrowlNotifier.notify', side_effect=Exception)
    notifier = GrowlNotifier()
    assert notifier.name == notifier_name
    assert notifier.notify('test') is False
    assert notifier.notify_download(download_item) is False
Exemplo n.º 6
0
def test_growl_disabled():
    notifier = GrowlNotifier()
    assert notifier.name == notifier_name
    assert notifier.notify('test') is False
    assert notifier.notify_download(download_item) is False
Exemplo n.º 7
0
def test_growl_disabled():
    notifier = GrowlNotifier()
    assert notifier.name == notifier_name
    assert notifier.notify_download(**item_dict) is False