Improve tests and add support for tagged decoding
This commit is contained in:
@@ -6,6 +6,7 @@ from io import StringIO
|
||||
import pytest
|
||||
|
||||
from pyrad3.dictionary import Dictionary, ParseError
|
||||
from pyrad3.types import Encrypt
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@@ -358,7 +359,8 @@ def test_unimplemented_tlvs():
|
||||
@pytest.mark.parametrize("flag", [1, 2, 3])
|
||||
def test_valid_attribute_encrpytion_flags(flag):
|
||||
dictionary = StringIO(f"ATTRIBUTE NAME 123 octets encrypt={flag}")
|
||||
Dictionary("", dictionary)
|
||||
rad_dict = Dictionary("", dictionary)
|
||||
assert rad_dict.attrindex[123].encrypt == Encrypt(flag)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("flag", ["0.1", "0", "4", "0x1", "0o2", "user", ""])
|
||||
@@ -370,7 +372,8 @@ def test_invalid_attribute_encrpytion_flags(flag):
|
||||
|
||||
def test_has_tag_flag():
|
||||
dictionary = StringIO("ATTRIBUTE NAME 123 octets has_tag")
|
||||
Dictionary("", dictionary)
|
||||
rad_dict = Dictionary("", dictionary)
|
||||
assert rad_dict.attrindex[123].has_tag
|
||||
|
||||
|
||||
@pytest.mark.parametrize("invalid_flag", ["blablub", "encrypt=2=2", "concat"])
|
||||
|
||||
Reference in New Issue
Block a user