renaming some functions
This commit is contained in:
@@ -131,46 +131,46 @@ def radius_dictionary():
|
||||
)
|
||||
def test_invalid_header(header):
|
||||
with pytest.raises(utils.PacketError):
|
||||
utils.parse_header(header)
|
||||
utils.decode_header(header)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("attr_bytes, expected", TEST_ATTRIBUTES)
|
||||
def test_parse_attribute_rfc(radius_dictionary, attr_bytes, expected):
|
||||
def test_decode_attribute_rfc(radius_dictionary, attr_bytes, expected):
|
||||
raw_packet = bytes(20) + attr_bytes
|
||||
attrs = utils.parse_attributes(radius_dictionary, raw_packet)
|
||||
attrs = utils.decode_attributes(radius_dictionary, raw_packet)
|
||||
assert len(attrs) == 1
|
||||
assert attrs[0].value == expected
|
||||
assert attrs[0].tag == 0
|
||||
|
||||
|
||||
@pytest.mark.parametrize("attr_bytes, expected", TEST_ATTRIBUTES)
|
||||
def test_parse_attribute_vsa(radius_dictionary, attr_bytes, expected):
|
||||
def test_decode_attribute_vsa(radius_dictionary, attr_bytes, expected):
|
||||
vsa_length = (6 + len(attr_bytes)).to_bytes(1, "big")
|
||||
raw_packet = (
|
||||
bytes(20) + b"\x1a" + vsa_length + b"\x00\x00\x04\xd2" + attr_bytes
|
||||
)
|
||||
attrs = utils.parse_attributes(radius_dictionary, raw_packet)
|
||||
attrs = utils.decode_attributes(radius_dictionary, raw_packet)
|
||||
assert len(attrs) == 1
|
||||
assert attrs[0].value == expected
|
||||
assert attrs[0].tag == 0
|
||||
|
||||
|
||||
@pytest.mark.parametrize("attr_bytes, expected", TAGGED_ATTRIBUTES)
|
||||
def test_parse_attribute_rfc_tagged(radius_dictionary, attr_bytes, expected):
|
||||
def test_decode_attribute_rfc_tagged(radius_dictionary, attr_bytes, expected):
|
||||
raw_packet = bytes(20) + attr_bytes
|
||||
attrs = utils.parse_attributes(radius_dictionary, raw_packet)
|
||||
attrs = utils.decode_attributes(radius_dictionary, raw_packet)
|
||||
assert len(attrs) == 1
|
||||
assert attrs[0].value == expected
|
||||
assert attrs[0].tag == 1
|
||||
|
||||
|
||||
@pytest.mark.parametrize("attr_bytes, expected", TAGGED_ATTRIBUTES)
|
||||
def test_parse_attribute_vsa_tagged(radius_dictionary, attr_bytes, expected):
|
||||
def test_decode_attribute_vsa_tagged(radius_dictionary, attr_bytes, expected):
|
||||
vsa_length = (6 + len(attr_bytes)).to_bytes(1, "big")
|
||||
raw_packet = (
|
||||
bytes(20) + b"\x1a" + vsa_length + b"\x00\x00\x04\xd2" + attr_bytes
|
||||
)
|
||||
attrs = utils.parse_attributes(radius_dictionary, raw_packet)
|
||||
attrs = utils.decode_attributes(radius_dictionary, raw_packet)
|
||||
assert len(attrs) == 1
|
||||
assert attrs[0].value == expected
|
||||
assert attrs[0].tag == 1
|
||||
|
||||
Reference in New Issue
Block a user