コード例 #1
0
def test_telegram_notify_download(monkeypatch):
    monkeypatch.setattr('autosubliminal.NOTIFYTELEGRAM', True)
    with requests_mock.mock() as m:
        # Mock successful request
        m.register_uri('POST', TELEGRAMURL % autosubliminal.TELEGRAMBOTAPI, status_code=200)
        notifier = TelegramNotifier()
        assert notifier.name == notifier_name
        assert notifier.notify('test') is True
        assert notifier.notify_download(download_item) is True
コード例 #2
0
def test_telegram_exception(monkeypatch):
    monkeypatch.setattr('autosubliminal.NOTIFYTELEGRAM', True)
    with requests_mock.mock() as m:
        # Mock exception request
        m.register_uri('POST', TELEGRAMURL % autosubliminal.TELEGRAMBOTAPI, exc=Exception)
        notifier = TelegramNotifier()
        assert notifier.name == notifier_name
        assert notifier.notify('test') is False
        assert notifier.notify_download(download_item) is False
コード例 #3
0
def test_telegram_notify_download(monkeypatch):
    monkeypatch.setattr('autosubliminal.NOTIFYTELEGRAM', True)
    with requests_mock.mock() as m:
        # Mock successful request
        m.register_uri('POST',
                       TELEGRAMURL % autosubliminal.TELEGRAMBOTAPI,
                       status_code=200)
        notifier = TelegramNotifier()
        assert notifier.name == notifier_name
        assert notifier.notify_download(**item_dict) is True
コード例 #4
0
def test_telegram_exception(monkeypatch):
    monkeypatch.setattr('autosubliminal.NOTIFYTELEGRAM', True)
    with requests_mock.mock() as m:
        # Mock exception request
        m.register_uri('POST',
                       TELEGRAMURL % autosubliminal.TELEGRAMBOTAPI,
                       exc=Exception)
        notifier = TelegramNotifier()
        assert notifier.name == notifier_name
        assert notifier.notify('test') is False
        assert notifier.notify_download(download_item) is False
コード例 #5
0
def test_telegram_disabled():
    notifier = TelegramNotifier()
    assert notifier.name == notifier_name
    assert notifier.notify('test') is False
    assert notifier.notify_download(download_item) is False
コード例 #6
0
def test_telegram_disabled():
    notifier = TelegramNotifier()
    assert notifier.name == notifier_name
    assert notifier.notify_download(**item_dict) is False
コード例 #7
0
def test_telegram_disabled():
    notifier = TelegramNotifier()
    assert notifier.name == notifier_name
    assert notifier.notify('test') is False
    assert notifier.notify_download(download_item) is False