Exemplo n.º 1
0
    def coro():
        h = GNTPHandler(loop=loop)

        notification = notifier.create_notification(
            name='Old', title="With a string call back", text="Press me")
        notification.add_callback('callback_test')
        logging.debug('GNTP: notify with string callback')
        response = yield from h.notify(notification, local_target)
        assert response['status'] == 'OK'
Exemplo n.º 2
0
    def coro():
        h = GNTPHandler(loop=loop)

        notification = notifier.create_notification(name='New',
                                                    title="With a call back",
                                                    text="Press me")
        notification.add_callback('http://news.bbc.co.uk')
        logging.debug('GNTP: notify with url callback')
        response = yield from h.notify(notification, local_target)
        assert response['status'] == 'OK'
Exemplo n.º 3
0
    def coro():
        h = GNTPHandler(loop=loop)

        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, local_target)
        assert response['status'] == 'OK'
Exemplo n.º 4
0
    def coro():
        h = GNTPHandler(loop=loop)

        notification = notifier.create_notification(name='New',
                                                    title="A brave new world",
                                                    text="Say hello to Prism")
        logging.debug('GNTP: notify')
        response = yield from h.register(notifier, local_target)
        print(response)
        response = yield from h.notify(notification, local_target)
        print(response)
        assert response['status'] == 'OK'
        assert response['status_code'] == 0
Exemplo n.º 5
0
    def coro():
        h = GNTPHandler(loop=loop)

        n1 = notifier.create_notification(name='New',
                                          title="A brave new world",
                                          text="Say hello to Prism")
        n1.add_callback('callback_test')

        n2 = notifier.create_notification(name='Old',
                                          title="A second Coming",
                                          text="Say hello to the Time Lords")

        logging.debug('GNTP: multiply notify')
        done, pending = yield from asyncio.wait(
            [h.notify(n1, local_target),
             h.notify(n2, local_target)])

        for task in done:
            response = task.result()
            assert response['status'] == 'OK'
            assert response['status_code'] == 0