def coro(): #target = Target('snp://%s' % HOST) t1 = Target('gntp://%s' % HOST) t2 = Target('xbmc://%s' % HOST) notification = async_notifier.create_notification( name='New', title='One notification', text='Sent to multiple targets') _response = yield from async_notifier.add_target([t1, t2]) _response = yield from async_notifier.notify(notification) pass
def test_Target_Init_EmptyTarget(): t = Target() assert t.scheme == 'snp' assert t.host == '127.0.0.1' assert t.port == -1 assert t.username is None assert t.password is None
def coro(): h = SNPHandler(loop=loop) t = Target('snp://%s' % HOST) response = yield from h.register(notifier, t) assert response['status'] == 'OK'
def coro(): #target = Target('snp://%s' % HOST) target = Target('gntp://%s' % HOST) _response = yield from async_notifier.add_target(target) _response = yield from async_notifier.register(target) pass
def test_Target_Init_WithUsernamePasswordAndPort(): t = Target('snp://*****:*****@192.168.1.1:9000') assert t.scheme == 'snp' assert t.host == '192.168.1.1' assert t.username == 'user' assert t.password == 'wally' assert t.port == 9000
def coro(): h = SNPHandler(loop=loop) t = Target('snp://%s' % HOST) yield from notifier.add_target(t) response = yield from h.subscribe(notifier, [], t) assert response['status'] == 'OK'
def coro(): h = SNPHandler(loop=loop) t = Target('snp://%s' % HOST) notification = notifier.create_notification(name='New', title="A brave new world", text="Say hello to Prism") response = yield from h.notify(notification, t) assert response['status'] == 'OK'
def coro(): h = PushoverHandler(apptoken='a23MprXQ5P4weDkKWLXR3swDjGa68q', loop=loop) t = Target('po://uDyCFupvhfxXcC5GSCvYw7ZUwzeoYa') notification = notifier.create_notification(name='New', title="A brave new world", text="Say hello to Prism") logging.debug('Pushover: notify bad app token') response = yield from h.notify(notification, t) assert response['status'] == 'ERROR'
def coro(): h = SNPHandler(loop=loop) t = Target('snp://%s' % HOST) notification = notifier.create_notification(name='New', title="With URL call back", text="Press me") notification.add_callback('http://news.bbc.co.uk/sport') response = yield from h.notify(notification, t) assert response['status'] == 'OK'
def coro(): h = PushbulletHandler(loop=loop) t = Target('pb://gBfoLoTocaLSQJtM7rWEJaEAPf5Pf') notification = notifier.create_notification(name='New', title="A brave new world", text="Say hello to Prism") logging.debug('Pushbullet: notify bad app token') response = yield from h.notify(notification, t) assert response['status'] == 'ERROR'
def coro(): h = SNPHandler(loop=loop) t = Target('snp://%s' % REMOTE_HOST) notification = notifier.create_notification( name='New', title="A brave new world", text="This notification should have an icon", icon=icon_inverted) response = yield from h.notify(notification, t) assert response['status'] == 'OK'
def coro(): #target = Target('snp://%s' % HOST) target = Target('gntp://%s' % HOST) notification = async_notifier.create_notification( name='Old', title='A notification', text='This is a wonderful notification') _response = yield from async_notifier.add_target(target) _response = yield from async_notifier.notify(notification, target) pass
def coro(): h = XBMCHandler(loop=loop) t = Target('xbmc://%s' % HOST) notification = notifier.create_notification(name='New', title="A brave new world", text="Say hello to Prism", icon='info') response = yield from h.notify(notification, t) if response['status'] == 'ERROR': assert response['reason'] == 'All hosts are unreachable.' else: assert response['status_code'] == 0
def test_SNPTarget_Init_HostOnly(): t = Target('snp://192.168.1.1') assert t.scheme == 'snp' assert t.host == '192.168.1.1'
def coro(): h = SNPHandler(loop=loop) t = Target('snp://%s' % INVALID_HOST) with pytest.raises(ConnectionError): _protocol = yield from h.connect(t)
def test_Target_Init_WithPassword(): t = Target('snp://:[email protected]') assert t.scheme == 'snp' assert t.host == '192.168.1.1' assert t.password == 'wally' assert t.port == -1
def test_Target_Init_WithUsernameAndPort(): t = Target('snp://[email protected]:8080') assert t.scheme == 'snp' assert t.host == '192.168.1.1' assert t.username == 'wally' assert t.port == 8080
def testTargetList_Append(): t = TargetList() kt = Target('kodi://192.168.1.1') t.targets.append(kt) t.remove(kt) assert len(t.targets) == 0
def test_Target_String_UsernamePasswordIsRemoved(): t = Target('snp://*****:*****@192.168.1.1:9000') assert str(t) == 'snp://192.168.1.1:9000'
def test_Target_IsRemote(): t = Target('snp://[email protected]:9000') assert t.is_remote
def testTargetList_Append(): t = TargetList() t.append(Target('kodi://192.168.1.1')) assert len(t.targets) == 1
def remote_target(): return Target('gntp://%s:%d' % (REMOTE_HOST, GNTP_DEFAULT_PORT))
def coro(): h = GNTPHandler(loop=loop) t = Target('gntp://%s' % INVALID_HOST) with pytest.raises((ConnectionError, TimeoutError)): _protocol = yield from h.connect(t)
def test_SNPTarget_Init_Empty(): t = Target('snp') assert t.scheme == 'snp' assert t.host == '127.0.0.1'
def coro(): h = SNPHandler(loop=loop) t = Target('snp://%s' % HOST) _protocol = yield from h.connect(t) assert t.handler == h
def test_BadProtocol(): with pytest.raises(TargetError): t = Target('wally')
def test_PushoverTarget_Init(): t = Target('po://adkhkahs') assert t.scheme == 'po' assert t.host == 'adkhkahs'
def test_ProwlTarget_Init(): t = Target('prowl://adkhkahs') assert t.scheme == 'prowl' assert t.host == 'adkhkahs'
def local_target(): return Target('gntp://%s:%d' % (HOST, GNTP_DEFAULT_PORT))
def test_GNTPTarget_Init_Host(): t = Target('gntp://192.168.1.1') assert t.scheme == 'gntp' assert t.host == '192.168.1.1'