How to use the panoramisk.Message function in panoramisk

To help you get started, we’ve selected a few panoramisk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gawel / irc3 / tests / test_asterirc.py View on Github external
# -*- coding: utf-8 -*-
from irc3.testing import BotTestCase
from irc3.testing import MagicMock
from irc3.testing import patch
from collections import defaultdict
from panoramisk import Message


class Event(Message):

    def __init__(self, event, **kwargs):
        self.name = event
        self.headers = dict(event=event, **kwargs)

    def __getitem__(self, name):
        return self.headers[name]

    def update(self, **kwargs):
        self.headers.update(kwargs)
        self.name = self.headers['event']


class TestAsterirc(BotTestCase):

    config = dict(
github gawel / irc3 / tests / test_asterirc.py View on Github external
def setUp(self):
        self.patch_asyncio()
        patcher = patch('panoramisk.Manager.send_action_via_http')
        self.send_action = patcher.start()
        self.response = Message(
            'response', '', headers={'Response': 'Success'})
        self.send_action.return_value = self.response
        self.addCleanup(patcher.stop)

        self.mocks = {}
        for name in ('connect', 'close'):
            patcher = patch('panoramisk.Manager.' + name)
            self.mocks[name] = patcher.start()
            self.addCleanup(patcher.stop)
github gawel / irc3 / examples / asterirc.py View on Github external
def send_action(self, *args, **kwargs):
        try:
            res = self.manager.send_action(*args, **kwargs)
            return res
        except Exception as e:
            self.log.error('send_action(%r, **%r)', args, kwargs)
            self.log.exception(e)
            return Message('response',
                           'Sorry an error occured. ({})'.format(repr(e)),
                           headers={'Response': 'Failed'})

panoramisk

asyncio based library to play with asterisk

MIT
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis

Similar packages