mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-06-03 22:31:18 +00:00
test(darc_mowas_service): check scope from alert region id logic
This commit is contained in:
@@ -128,6 +128,27 @@ def _mowas_service_bot():
|
||||
return bot
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
class TestScopeByRegion:
|
||||
def test_hierarchical_lookup(self):
|
||||
bot = _mowas_service_bot()
|
||||
bot.config.set("DARC_MoWaS_Service", "flood_scope.090000000000", "#de-by")
|
||||
bot.config.set("DARC_MoWaS_Service", "flood_scope.091840000000", "#de-by-muc")
|
||||
svc = DARC_MoWaS_Service(bot)
|
||||
# City Haar within LK Munich
|
||||
area = TRDECapAlertArea(areaDesc="Stadt Haar", geocode=[("SHN", "091841230000")])
|
||||
info = TRDECapAlertInfo(language="de", category=None, event=None, urgency=None,
|
||||
severity=None, certainty=None, description="", parameter=[], headline=None, area=[area])
|
||||
# most specific wins
|
||||
assert svc.scope_by_region(info) == "#de-by-muc"
|
||||
# broader prefix
|
||||
area.geocode = [("SHN", "091000000000")]
|
||||
assert svc.scope_by_region(info) == "#de-by"
|
||||
# no match
|
||||
area.geocode = [("SHN", "050000000000")]
|
||||
assert svc.scope_by_region(info) is None
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.asyncio
|
||||
async def test_send_chunks_assigns_ascending_timestamps_per_index():
|
||||
|
||||
Reference in New Issue
Block a user