Example #1
0
class DispatcherTestCase(TestCase):

    def setUp(self):
        self.dispatcher = Dispatcher('andrews', 'andrews', 'sometoken')

    def test_send_request_to_server(self):
        response = self.dispatcher.send_request('http://someurl.com')
        self.assertEqual('request added with success!', response)

    def test_send_error_to_server(self):
        response = self.dispatcher.send_error('some excpetion', 'http://someurl.com', 'some traceback')
        self.assertEqual('error added with success!', response)

    def test_send_response_to_server(self):
        response = self.dispatcher.send_response('http://someurl.com', 1.234)
        self.assertEqual('response added with success!', response)
Example #2
0
    def __init__(self):
        self.dispatcher = Dispatcher()
        self.rmanager = None

        pika_settings = dict(host="localhost",
                             port=5672,
                             vhost="/",
                             user="******",
                             passwd="guest",
                             exchange="tornado",
                             queue_name="tornado-test-%i" % os.getpid(),
                             routing_key="tornado.*")

        self.rmanager = PikaClient(pika_settings, self)

        handlers = [
            (r"/", IndexHandler),
            (r"/producer", ProducerHandler),
            (r"/consumer", ConsumerHandler),
        ]

        settings = dict(
            cookie_secret="__TODO:_GENERATE_YOUR_OWN_RANDOM_VALUE_HERE__",
            template_path=os.path.join(os.path.dirname(__file__), "templates"),
            static_path=os.path.join(os.path.dirname(__file__), "static"),
            xsrf_cookies=True,
            autoescape=None,
        )

        tornado.web.Application.__init__(self, handlers, **settings)
Example #3
0
class DispatcherTestCase(TestCase):
    def setUp(self):
        self.dispatcher = Dispatcher('andrews', 'andrews', 'sometoken')

    def test_send_request_to_server(self):
        response = self.dispatcher.send_request('http://someurl.com')
        self.assertEqual('request added with success!', response)

    def test_send_error_to_server(self):
        response = self.dispatcher.send_error('some excpetion',
                                              'http://someurl.com',
                                              'some traceback')
        self.assertEqual('error added with success!', response)

    def test_send_response_to_server(self):
        response = self.dispatcher.send_response('http://someurl.com', 1.234)
        self.assertEqual('response added with success!', response)
Example #4
0
    def __init__(self, bind, **kwargs):
        "x.__init__(...) initializes x; see x.__class__.__doc__ for signature"

        super(Server, self).__init__(bind, **kwargs)

        Dispatcher(channel=self.channel).register(self)
Example #5
0
 def setUp(self):
     self.dispatcher = Dispatcher('andrews', 'andrews', 'sometoken')
Example #6
0
 def setUp(self):
     self.dispatcher = Dispatcher('andrews', 'andrews', 'sometoken')
Example #7
0
    def __init__(self, bind, **kwargs):
        super(Server, self).__init__(bind, **kwargs)

        Dispatcher().register(self)
Example #8
0
 def __init__(self):
     username = settings.STARDUST_USERNAME
     password = settings.STARDUST_PASSWORD
     token = settings.STARDUST_PROJECT_TOKEN
     self.dispatcher = Dispatcher(username, password, token)
Example #9
0
    def __init__(self):
        super(Application, self).__init__()

        Dispatcher().register(self)