Beispiel #1
0
    def test_reraise_error(self):
        m = Message(Mock(), 'body')
        callback = Mock(name='callback')
        try:
            raise KeyError('foo')
        except KeyError as exc:
            m.errors.append(sys.exc_info())
        m._reraise_error(callback)
        self.assertTrue(callback.called)

        with self.assertRaises(KeyError):
            m._reraise_error(None)
Beispiel #2
0
    def test_reraise_error(self):
        m = Message('body', channel=Mock())
        callback = Mock(name='callback')
        try:
            raise KeyError('foo')
        except KeyError:
            m.errors.append(sys.exc_info())
        m._reraise_error(callback)
        callback.assert_called()

        with pytest.raises(KeyError):
            m._reraise_error(None)
Beispiel #3
0
    def test_reraise_error(self):
        m = Message('body', channel=Mock())
        callback = Mock(name='callback')
        try:
            raise KeyError('foo')
        except KeyError:
            m.errors.append(sys.exc_info())
        m._reraise_error(callback)
        callback.assert_called()

        with pytest.raises(KeyError):
            m._reraise_error(None)
Beispiel #4
0
    def test_reraise_error(self):
        m = Message(Mock(), "body")
        callback = Mock(name="callback")
        try:
            raise KeyError("foo")
        except KeyError:
            m.errors.append(sys.exc_info())
        m._reraise_error(callback)
        callback.assert_called()

        with self.assertRaises(KeyError):
            m._reraise_error(None)
Beispiel #5
0
    def test_reraise_error(self):
        m = Message(Mock(), 'body')
        callback = Mock(name='callback')
        try:
            raise KeyError('foo')
        except KeyError:
            m.errors.append(sys.exc_info())
        m._reraise_error(callback)
        self.assertTrue(callback.called)

        with self.assertRaises(KeyError):
            m._reraise_error(None)
Beispiel #6
0
 def test_decompression_stores_error(self, decompress):
     decompress.side_effect = RuntimeError()
     m = Message('body', channel=Mock(), headers={'compression': 'zlib'})
     with pytest.raises(RuntimeError):
         m._reraise_error(None)
Beispiel #7
0
 def test_postencode(self):
     m = Message('FOO', channel=self.channel, postencode='ccyzz')
     with pytest.raises(LookupError):
         m._reraise_error()
     m.ack()
Beispiel #8
0
 def test_decompression_stores_error(self, decompress):
     decompress.side_effect = RuntimeError()
     m = Message(Mock(), 'body', headers={'compression': 'zlib'})
     with self.assertRaises(RuntimeError):
         m._reraise_error(None)
Beispiel #9
0
 def test_decompression_stores_error(self, decompress):
     decompress.side_effect = RuntimeError()
     m = Message('body', channel=Mock(), headers={'compression': 'zlib'})
     with pytest.raises(RuntimeError):
         m._reraise_error(None)
 def test_postencode(self):
     m = Message(self.channel, text_t('FOO'), postencode='ccyzz')
     with self.assertRaises(LookupError):
         m._reraise_error()
     m.ack()
Beispiel #11
0
 def test_postencode(self):
     m = Message(text_t('FOO'), channel=self.channel, postencode='ccyzz')
     with pytest.raises(LookupError):
         m._reraise_error()
     m.ack()
Beispiel #12
0
 def test_postencode(self):
     m = Message(self.channel, text_t('FOO'), postencode='ccyzz')
     with self.assertRaises(LookupError):
         m._reraise_error()
     m.ack()
Beispiel #13
0
 def test_decompression_stores_error(self, decompress):
     decompress.side_effect = RuntimeError()
     m = Message(Mock(), "body", headers={"compression": "zlib"})
     with self.assertRaises(RuntimeError):
         m._reraise_error(None)
Beispiel #14
0
 def test_decompression_stores_error(self, decompress):
     decompress.side_effect = RuntimeError()
     m = Message(Mock(), 'body', headers={'compression': 'zlib'})
     with self.assertRaises(RuntimeError):
         m._reraise_error(None)