Esempio n. 1
0
 def test_decode(self):
     m = Message('body', channel=Mock())
     decode = m._decode = Mock()
     assert m._decoded_cache is None
     assert m.decode() is m._decode.return_value
     assert m._decoded_cache is m._decode.return_value
     m._decode.assert_called_with()
     m._decode = Mock()
     assert m.decode() is decode.return_value
Esempio n. 2
0
 def test_decode(self):
     m = Message('body', channel=Mock())
     decode = m._decode = Mock()
     assert m._decoded_cache is None
     assert m.decode() is m._decode.return_value
     assert m._decoded_cache is m._decode.return_value
     m._decode.assert_called_with()
     m._decode = Mock()
     assert m.decode() is decode.return_value
Esempio n. 3
0
 def test_decode(self):
     m = Message(Mock(), 'body')
     decode = m._decode = Mock()
     self.assertIsNone(m._decoded_cache)
     self.assertIs(m.decode(), m._decode.return_value)
     self.assertIs(m._decoded_cache, m._decode.return_value)
     m._decode.assert_called_with()
     m._decode = Mock()
     self.assertIs(m.decode(), decode.return_value)
Esempio n. 4
0
 def test_decode(self):
     m = Message(Mock(), "body")
     decode = m._decode = Mock()
     self.assertIsNone(m._decoded_cache)
     self.assertIs(m.decode(), m._decode.return_value)
     self.assertIs(m._decoded_cache, m._decode.return_value)
     m._decode.assert_called_with()
     m._decode = Mock()
     self.assertIs(m.decode(), decode.return_value)