Example #1
0
def decoder_app(base_pipeline):
    return DecoderApp(base_pipeline)
Example #2
0
 def test_check_checksum_trailing_bytes_raises_exception(
         self, simple_encoded_msg):
     with pytest.raises(ParsingError):
         message = simple_encoded_msg + b"34=1" + settings.SOH
         DecoderApp.check_checksum(message)
Example #3
0
 def test_check_checksum_raises_exception_if_checksum_invalid(
         self, simple_encoded_msg):
     with pytest.raises(ParsingError):
         encoded_msg = simple_encoded_msg[:-4] + b"123" + settings.SOH
         DecoderApp.check_checksum(encoded_msg, 0, 19)
Example #4
0
 def test_check_checksum(self, simple_encoded_msg):
     checksum, _ = DecoderApp.check_checksum(simple_encoded_msg)
     assert checksum == 163
Example #5
0
 def test_check_checksum_not_found_raises_exception(self,
                                                    simple_encoded_msg):
     with pytest.raises(ParsingError):
         encoded_msg = simple_encoded_msg[:-7]
         DecoderApp.check_checksum(encoded_msg)
Example #6
0
 def test_body_length_not_found_raises_exception(self, simple_encoded_msg):
     with pytest.raises(ParsingError):
         encoded_msg = simple_encoded_msg[:9] + simple_encoded_msg[13:]
         DecoderApp.check_body_length(encoded_msg)
Example #7
0
 def test_check_body_length_wrong_length_raises_exception(
         self, simple_encoded_msg):
     with pytest.raises(ParsingError):
         encoded_msg = b"8=FIX.4.4\x019=1\x0135=0\x0110=161\x01"
         assert DecoderApp.check_body_length(encoded_msg) == (b"5", 9, 13)
Example #8
0
 def test_check_body_length_body_end_not_provided(self, simple_encoded_msg):
     assert DecoderApp.check_body_length(simple_encoded_msg) == (5, 13)
Example #9
0
 def test_check_body_length(self, simple_encoded_msg):
     assert DecoderApp.check_body_length(simple_encoded_msg,
                                         start=0,
                                         body_end=19) == (5, 13)
Example #10
0
 def test_check_begin_string_not_at_start_raises_exception(
         self, simple_encoded_msg):
     with pytest.raises(ParsingError):
         DecoderApp.check_begin_string(b"34=0" + settings.SOH +
                                       simple_encoded_msg)
Example #11
0
 def test_check_begin_string_not_found_raises_exception(
         self, simple_encoded_msg):
     with pytest.raises(ParsingError):
         DecoderApp.check_begin_string(simple_encoded_msg[10:])
Example #12
0
 def test_check_begin_string(self, simple_encoded_msg):
     assert DecoderApp.check_begin_string(simple_encoded_msg) == (
         b"FIX.4.4", 9)