Esempio n. 1
0
 def test_parse_partial(self):
     TEST_TLV_DATA_1_TRUNCATED = (
         b"\x03\x00\x04Z\xfd\xc6\xff\x02\x00\tAUTHORITI\x05\x00\tUNIKUE_I")
     rslt: Dict[str, Any]
     rslt, _ = ProxyTLV.parse(TEST_TLV_DATA_1_TRUNCATED)
     assert isinstance(rslt, dict)
     assert "CRC32C" in rslt
Esempio n. 2
0
 def test_malformed_ssl_partialok(self):
     test_data = (
         b"\x20\x00\x17\x01\x02\x03\x04\x05\x21\x00\x07version\x22\x00\x09trunc"
     )
     rslt: Dict[str, Any]
     rslt, _ = ProxyTLV.parse(test_data, partial_ok=True)
     assert rslt["SSL"] is False
     assert rslt["SSL_VERSION"] == b"version"
     assert "SSL_CN" not in rslt
Esempio n. 3
0
 def test_malformed_ssl_notpartialok(self):
     test_data = (
         b"\x20\x00\x0D\x01\x02\x03\x04\x05\x21\x00\x07version\x22\x00\x09trunc"
     )
     with pytest.raises(MalformedTLV):
         _ = ProxyTLV.parse(test_data, partial_ok=False)
Esempio n. 4
0
 def test_unknowntype_strict(self):
     test_data = b"\xFF\x00\x04yeah"
     with pytest.raises(UnknownTypeTLV):
         _ = ProxyTLV.parse(test_data, strict=True)
Esempio n. 5
0
 def test_unknowntype_notstrict(self):
     test_data = b"\xFF\x00\x04yeah"
     rslt: Dict[str, Any]
     rslt, _ = ProxyTLV.parse(test_data, strict=False)
     assert "xFF" in rslt
     assert rslt["xFF"] == b"yeah"