openpilot is an open source driver assistance system. openpilot performs the functions of Automated Lane Centering and Adaptive Cruise Control for over 200 supported car makes and models.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.3 KiB

import pytest
from openpilot.system.hardware import TICI
from openpilot.system.hardware.tici.esim import LPA, LPAProfileNotFoundError
2 months ago
# https://euicc-manual.osmocom.org/docs/rsp/known-test-profile
2 months ago
# iccid is always the same for the given activation code
2 months ago
TEST_ACTIVATION_CODE = 'LPA:1$rsp.truphone.com$QRF-BETTERROAMING-PMRDGIR2EARDEIT5'
TEST_ICCID = '8944476500001944011'
2 months ago
2 months ago
TEST_NICKNAME = 'test_profile'
def cleanup():
lpa = LPA()
2 months ago
try:
lpa.delete_profile(TEST_ICCID)
except LPAProfileNotFoundError:
pass
lpa.process_notifications()
class TestEsim:
@classmethod
def setup_class(cls):
if not TICI:
pytest.skip()
cleanup()
2 months ago
@classmethod
def teardown_class(cls):
cleanup()
2 months ago
def test_provision_enable_disable(self):
lpa = LPA()
2 months ago
current_active = lpa.get_active_profile()
2 months ago
lpa.download_profile(TEST_ACTIVATION_CODE, TEST_NICKNAME)
2 months ago
assert any(p.iccid == TEST_ICCID and p.nickname == TEST_NICKNAME for p in lpa.list_profiles())
2 months ago
lpa.enable_profile(TEST_ICCID)
new_active = lpa.get_active_profile()
assert new_active is not None
2 months ago
assert new_active.iccid == TEST_ICCID
assert new_active.nickname == TEST_NICKNAME
2 months ago
lpa.disable_profile(TEST_ICCID)
new_active = lpa.get_active_profile()
assert new_active is None
if current_active:
2 months ago
lpa.enable_profile(current_active.iccid)