pull/35314/head
Trey Moen 1 week ago
parent 4c9038e5e7
commit db2dc82ab5
  1. 32
      system/hardware/tici/tests/test_esim.py

@ -18,24 +18,11 @@ class TestEsim:
if not TICI: if not TICI:
pytest.skip() pytest.skip()
def ensure_profile_deleted(self):
lpa = LPA2()
try:
lpa.delete_profile(self.TEST_ICCID)
except LPAProfileNotFoundError:
pass
assert not self._profile_exists(self.TEST_ICCID, self.TEST_NICKNAME)
def setup_method(self): def setup_method(self):
self.ensure_profile_deleted() self._cleanup()
# clear out any pending notifications
lpa = LPA2()
lpa.process_notifications()
assert len(lpa.list_notifications()) == 0
def teardown_method(self): def teardown_method(self):
self.ensure_profile_deleted() self._cleanup()
def test_list_profiles(self): def test_list_profiles(self):
lpa = LPA2() lpa = LPA2()
@ -44,10 +31,6 @@ class TestEsim:
def test_download_profile(self): def test_download_profile(self):
lpa = LPA2() lpa = LPA2()
try:
lpa.delete_profile(self.TEST_ICCID)
except Exception as e:
print(e)
lpa.download_profile(self.TEST_ACTIVATION_CODE, self.TEST_NICKNAME) lpa.download_profile(self.TEST_ACTIVATION_CODE, self.TEST_NICKNAME)
assert self._profile_exists(self.TEST_ICCID, self.TEST_NICKNAME) assert self._profile_exists(self.TEST_ICCID, self.TEST_NICKNAME)
@ -65,6 +48,17 @@ class TestEsim:
current = lpa.get_active_profile() current = lpa.get_active_profile()
assert current is None assert current is None
def _cleanup(self):
lpa = LPA2()
try:
lpa.delete_profile(self.TEST_ICCID)
except LPAProfileNotFoundError:
pass
assert not self._profile_exists(self.TEST_ICCID, self.TEST_NICKNAME)
lpa = LPA2()
lpa.process_notifications()
assert len(lpa.list_notifications()) == 0
def _profile_exists(self, iccid: str, nickname: str) -> bool: def _profile_exists(self, iccid: str, nickname: str) -> bool:
lpa = LPA2() lpa = LPA2()
profiles = lpa.list_profiles() profiles = lpa.list_profiles()

Loading…
Cancel
Save