40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
import pytest
|
|
|
|
def test_initial_state(bg95_mock):
|
|
"""Verify initial state of the mock module."""
|
|
assert bg95_mock.check_state() is True
|
|
assert bg95_mock.read_firmware_version() == "Mock_Modem_v2.0"
|
|
assert bg95_mock.read_imei() == "864215030000000"
|
|
|
|
def test_radio_control(bg95_mock):
|
|
"""Test enabling/disabling radio functionality."""
|
|
# Turn Off
|
|
assert bg95_mock.radio_off() is True
|
|
assert bg95_mock.is_radio_on() is False
|
|
|
|
# Turn On
|
|
assert bg95_mock.radio_on() is True
|
|
assert bg95_mock.is_radio_on() is True
|
|
|
|
def test_network_attachment(bg95_mock):
|
|
"""Test network attach/detach sequence."""
|
|
bg95_mock.radio_on()
|
|
|
|
# Detach
|
|
assert bg95_mock.detach_network() is True
|
|
assert bg95_mock.is_attached() is False
|
|
|
|
# Attach
|
|
assert bg95_mock.attach_network() is True
|
|
assert bg95_mock.is_attached() is True
|
|
|
|
def test_sim_unlock(bg95_mock):
|
|
"""Test SIM PIN unlocking."""
|
|
# Mock starts in READY or some state, unlock should return True
|
|
assert bg95_mock.unlock_sim("1234") is True
|
|
|
|
def test_signal_quality(bg95_mock):
|
|
"""Test reading signal quality."""
|
|
rssi, ber = bg95_mock.get_signal_quality()
|
|
assert rssi == 25
|
|
assert ber == 99
|