Esempio n. 1
0
        outbound = u.format(inbound)
        self.assertEqual(outbound, inbound)

        inbound = Message({'text': 'hello world'})
        outbound = u.format(inbound)
        self.assertEqual(json.loads(outbound), {
            "text": "hello world",
            "type": "message"
        })

        inbound = Message({'personEmail': '*****@*****.**'})
        outbound = u.format(inbound)
        self.assertEqual(json.loads(outbound), {
            "type": "message",
            "personEmail": "*****@*****.**"
        })

        inbound = Message({'text': 'hello world', 'personEmail': '*****@*****.**'})
        outbound = u.format(inbound)
        self.assertEqual(json.loads(outbound), {
            "text": "hello world",
            "type": "message",
            "personEmail": "*****@*****.**"
        })


if __name__ == '__main__':

    Context.set_logger()
    sys.exit(unittest.main())
Esempio n. 2
0
  interactions, and reproduce them at will.


For example, if you run this script under Linux or macOs::

    python hello_simulator.py

"""

import logging
import os

from shellbot import Engine, Context, Command


class Hello(Command):
    keyword = 'hello'
    information_message = u"Hello, World!"


if __name__ == '__main__':

    Context.set_logger(level=logging.INFO)

    engine = Engine(command=Hello(), type='local')

    engine.space.push(['help', 'hello', 'help help'])

    engine.configure()
    engine.run()