mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-25 14:58:33 +03:00
pySim.esim.saip: Meaningful defaults in PE Constructor + test
Let's make sure the constructor of ProfileElement subclasses set meaningful defaults to the self.decoded member, so that the to_der() method can actually encode it. This is required when constructing a profile from scratch, as opposed to loading an existing one from DER. Also, add a test to verify that the encoder passes without exception; doesn't test the generated binary data. Change-Id: I401bca16e58461333733877ec79102a5ae7fe410
This commit is contained in:
@@ -63,6 +63,17 @@ class SaipTest(unittest.TestCase):
|
||||
# TODO: we don't actually test the results here, but we just verify there is no exception
|
||||
pes.to_der()
|
||||
|
||||
def test_constructor_encode(self):
|
||||
"""Test that DER-encoding of PE created by "empty" constructor works without raising exception."""
|
||||
for cls in [ProfileElementMF, ProfileElementPuk, ProfileElementPin, ProfileElementTelecom,
|
||||
ProfileElementUSIM, ProfileElementISIM]:
|
||||
with self.subTest(cls.__name__):
|
||||
pes = ProfileElementSequence()
|
||||
inst = cls()
|
||||
pes.append(inst)
|
||||
pes.to_der()
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user