aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2024-01-30 21:15:39 +0100
committerHarald Welte <laforge@osmocom.org>2024-01-30 21:33:41 +0100
commit93bdf00967951a8e25665d0f9774bd9fe263892b (patch)
tree0b2ec88765cf58b948f8779cf1bae9e240c9877a /tests
parentd7715043a31275fd0ed86407b84d78c240b2fbe4 (diff)
pySim.esim: Add class for parsing/encoding eSIM activation codes
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_esim.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_esim.py b/tests/test_esim.py
index d4b494e..81926e5 100755
--- a/tests/test_esim.py
+++ b/tests/test_esim.py
@@ -22,9 +22,22 @@ import base64
from pySim.utils import b2h, h2b
from pySim.esim.bsp import *
import pySim.esim.rsp as rsp
+from pySim.esim import ActivationCode
from cryptography.hazmat.primitives.asymmetric import ec
+class TestActivationCode(unittest.TestCase):
+ def test_de_encode(self):
+ STRS = ['1$SMDP.GSMA.COM$04386-AGYFT-A74Y8-3F815',
+ '1$SMDP.GSMA.COM$04386-AGYFT-A74Y8-3F815$$1',
+ '1$SMDP.GSMA.COM$04386-AGYFT-A74Y8-3F815$1.3.6.1.4.1.31746$1',
+ '1$SMDP.GSMA.COM$04386-AGYFT-A74Y8-3F815$1.3.6.1.4.1.31746',
+ '1$SMDP.GSMA.COM$$1.3.6.1.4.1.31746']
+ for s in STRS:
+ ac = ActivationCode.from_string(s)
+ self.assertEqual(s, ac.to_string())
+
+
class TestECKA(unittest.TestCase):
def test_mode51(self):
curve = ec.SECP256R1()