Ejemplo n.º 1
0
    def test_posting_exception(self):
        os.environ['ERRBIT_API_KEY'] = 'abcd1234'
        os.environ['ERRBIT_URL'] = 'http://errbit.local/api'
        request_data = {'url': 'http://foo/bar'}
        env_data = {'project-root': os.getcwd()}
        client = Client()

        xmlgenerator = self.mocker.replace('errbit.xmlgenerator.generate_xml')
        self.expect(xmlgenerator('abcd1234', client.get_notifier(),
                                 EXC_INFO, request=request_data, environment=env_data)
                    ).result('<XMLDATA/>')

        self.mocker.replay()
        client.post(EXC_INFO, request=request_data)

        self.assertEquals([{'data': '<XMLDATA/>', 'url': 'http://errbit.local/api'}],
                          self.http_client.posted)
Ejemplo n.º 2
0
    def test_posting_exception(self):
        os.environ["ERRBIT_API_KEY"] = "abcd1234"
        os.environ["ERRBIT_URL"] = "http://errbit.local/api"
        request_data = {"url": "http://foo/bar"}
        env_data = {"project-root": os.getcwd()}
        client = Client()

        xmlgenerator = self.mocker.replace("errbit.xmlgenerator.generate_xml")
        self.expect(
            xmlgenerator("abcd1234", client.get_notifier(), EXC_INFO, request=request_data, environment=env_data)
        ).result("<XMLDATA/>")

        self.mocker.replay()
        client.post(EXC_INFO, request=request_data)
        while threading.active_count() > 1:
            pass

        self.assertEquals([{"data": "<XMLDATA/>", "url": "http://errbit.local/api"}], self.http_client.posted)
Ejemplo n.º 3
0
    def test_posting_exception(self):
        os.environ['ERRBIT_API_KEY'] = 'abcd1234'
        os.environ['ERRBIT_URL'] = 'http://errbit.local/api'
        request_data = {'url': 'http://foo/bar'}
        env_data = {'project-root': os.getcwd()}
        client = Client()

        xmlgenerator = self.mocker.replace('errbit.xmlgenerator.generate_xml')
        self.expect(
            xmlgenerator('abcd1234',
                         client.get_notifier(),
                         EXC_INFO,
                         request=request_data,
                         environment=env_data)).result('<XMLDATA/>')

        req_class = self.mocker.replace('errbit.request.ThreadedRequest')
        req = self.mocker.mock()
        self.expect(req_class('http://errbit.local/api',
                              '<XMLDATA/>')).result(req)
        self.expect(req.start())

        self.mocker.replay()
        client.post(EXC_INFO, request=request_data)
Ejemplo n.º 4
0
    def test_posting_exception(self):
        os.environ['ERRBIT_API_KEY'] = 'abcd1234'
        os.environ['ERRBIT_URL'] = 'http://errbit.local/api'
        request_data = {'url': 'http://foo/bar'}
        env_data = {'project-root': os.getcwd()}
        client = Client()

        xmlgenerator = self.mocker.replace('errbit.xmlgenerator.generate_xml')
        self.expect(
            xmlgenerator('abcd1234',
                         client.get_notifier(),
                         EXC_INFO,
                         request=request_data,
                         environment=env_data)).result('<XMLDATA/>')

        self.mocker.replay()
        client.post(EXC_INFO, request=request_data)
        while threading.active_count() > 1:
            pass

        self.assertEquals([{
            'data': '<XMLDATA/>',
            'url': 'http://errbit.local/api'
        }], self.http_client.posted)