Keep B2 client fixes and move VPS implementation to its standalone repository
This commit is contained in:
@@ -1,17 +1,9 @@
|
||||
"""Both-SIM permission is not a promise of priority or automatic failover."""
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
|
||||
import pytest
|
||||
from test_equipment_network import context, full_core_context # noqa: F401
|
||||
from test_vps_host import ( # noqa: F401
|
||||
full_context,
|
||||
reach_sim_restart,
|
||||
sim_context,
|
||||
sim_packet,
|
||||
store,
|
||||
)
|
||||
|
||||
from k1link.device_plugins.arnavi_b2 import profiles
|
||||
from k1link.device_plugins.arnavi_b2.usb_protocol import Configuration, Setting
|
||||
@@ -37,49 +29,6 @@ def test_both_permission_preserves_apns_passwords_and_other_flags(flags):
|
||||
profiles.Policy(connectivity={"strategy": "both", "apn": "conflict"})
|
||||
|
||||
|
||||
def both_context(source):
|
||||
command, body, before, target, wire, now = source
|
||||
# Existing exclusive target becomes the predecessor; remove its prohibition.
|
||||
body.pop("sim_slot")
|
||||
body.update(
|
||||
sim_policy="both",
|
||||
expected_sha256=hashlib.sha256(target.encode()).hexdigest(),
|
||||
target_configuration=before.encode().hex(),
|
||||
)
|
||||
return command, body, target, before, wire, now
|
||||
|
||||
|
||||
@pytest.mark.parametrize("slot", [1, 2])
|
||||
def test_both_requires_readback_then_fresh_gprs_on_new_session(sim_context, slot): # noqa: F811
|
||||
command, body, before, target, wire, now = both_context(sim_context)
|
||||
reach_sim_restart((command, body, before, target, wire, now))
|
||||
assert command.take(body["imei"], "live")[-3:-1] == b"\x01\x07"
|
||||
now[0] += 10
|
||||
command.receive(body["imei"], sim_packet(now[0], slot=slot), "live")
|
||||
assert command.get(body["id"])["state"] == "dispatched"
|
||||
command.session_started[body["imei"], "new"] = now[0] - 1700000000
|
||||
now[0] += 1
|
||||
command.receive(body["imei"], sim_packet(now[0], slot=slot, gsm=3), "new")
|
||||
assert command.get(body["id"])["state"] == "dispatched"
|
||||
command.receive(body["imei"], sim_packet(now[0], slot=slot), "new")
|
||||
result = command.get(body["id"])
|
||||
assert result["state"] == "sim_selected" and result["active_sim"] == slot
|
||||
assert result["sim_policy"] == "both"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("bad", ["slot", "flags", "policy"])
|
||||
def test_vps_rejects_contradictory_both_request(sim_context, bad): # noqa: F811
|
||||
command, body, before, _, _, _ = both_context(sim_context)
|
||||
if bad == "slot":
|
||||
body["sim_slot"] = 1
|
||||
elif bad == "flags":
|
||||
body["target_configuration"] = before.encode().hex()
|
||||
else:
|
||||
body["sim_policy"] = "preferred"
|
||||
with pytest.raises(ValueError):
|
||||
command.submit(body)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("slot", [1, 2])
|
||||
def test_core_both_receipt_accepts_either_real_slot_and_no_configuration_only_success(
|
||||
full_core_context, # noqa: F811
|
||||
|
||||
Reference in New Issue
Block a user