Example #1
0
    def test_request_is_sent(self):
        http_client = MockHTTPClient()

        req = ThreadedRequest('http://foo/bar', '<data></data>',
                              http_client=http_client)
        req.run()  # synced call

        self.assertEquals([{'url': 'http://foo/bar',
                            'data': '<data></data>'}],
                          http_client.posted)
Example #2
0
    def test_exceptions_are_catched_and_printed(self):
        http_client = ErrorMockHTTPClient()
        log = StringIO()
        req = ThreadedRequest('http://foo/bar',
                              '<data></data>',
                              http_client=http_client,
                              log=log)

        with NothingRaised():
            req.run()  # synced call

        self.assertEquals('ERROR: Failed to post to errbit: Exception: HTTP Error',
                          log.getvalue())
Example #3
0
    def test_request_is_sent(self):
        self.expect_request('http://foo/bar', '<data></data>')
        self.mocker.replay()

        req = ThreadedRequest('http://foo/bar', '<data></data>')
        req.run()  # synced call