From b8f2346de40f54ecb390e4f80cee1dc176fa078e Mon Sep 17 00:00:00 2001 From: Julien Alie Date: Tue, 2 Apr 2024 10:11:25 -0400 Subject: [PATCH] fix integration tests - Fix an issue w/ calls without tenant_uuid or user_uuid - Up default parking timeout to 45 to prevent channels from timing out before all channels are parked with a slow asterisk --- .../assets/etc/asterisk/res_parking.conf | 2 +- integration_tests/suite/helpers/confd.py | 8 ++++---- integration_tests/suite/test_parkings.py | 19 +++++++++---------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/integration_tests/assets/etc/asterisk/res_parking.conf b/integration_tests/assets/etc/asterisk/res_parking.conf index f73343207..bce6d0be5 100644 --- a/integration_tests/assets/etc/asterisk/res_parking.conf +++ b/integration_tests/assets/etc/asterisk/res_parking.conf @@ -3,7 +3,7 @@ parkext = 500 context = parkings parkedmusicclass = default parkpos = 501-510 -parkingtime = 5 +parkingtime = 45 findslot = next parkext_exclusive = yes diff --git a/integration_tests/suite/helpers/confd.py b/integration_tests/suite/helpers/confd.py index 599e95650..9d4121a0e 100644 --- a/integration_tests/suite/helpers/confd.py +++ b/integration_tests/suite/helpers/confd.py @@ -365,14 +365,14 @@ def __init__( slots_end: str | None = None, timeout: int | None = None, tenant_uuid: str | None = None, - extension: int = 500, + extension: str = '500', ): self._id = id self._name = name or ''.join( choice(ascii_uppercase + digits) for _ in range(10) ) - self._slots_start = slots_start or str(extension + 1) - self._slots_end = slots_end or str(extension + 2) + self._slots_start = slots_start or str(int(extension) + 1) + self._slots_end = slots_end or str(int(extension) + 2) self._timeout = timeout or 45 self._tenant_uuid = tenant_uuid or '' self._extension = extension @@ -387,7 +387,7 @@ def to_dict(self) -> ParkingLotSchema: { 'id': 1000, 'context': 'some-ctx', - 'exten': str(self._extension), + 'exten': self._extension, } ] diff --git a/integration_tests/suite/test_parkings.py b/integration_tests/suite/test_parkings.py index 0bc79e3be..d8ff57a75 100644 --- a/integration_tests/suite/test_parkings.py +++ b/integration_tests/suite/test_parkings.py @@ -39,7 +39,7 @@ class ParkingLotArgs(TypedDict, total=False): id: Required[int] tenant_uuid: NotRequired[str] name: NotRequired[str] - extension: NotRequired[int] + extension: NotRequired[str] slots_start: NotRequired[str] slots_end: NotRequired[str] timeout: NotRequired[int] @@ -50,16 +50,16 @@ class ParkingLotArgs(TypedDict, total=False): 'id': 1, 'tenant_uuid': VALID_TENANT, 'name': 'First Parking', - 'extension': 500, + 'extension': '500', 'slots_start': '501', 'slots_end': '510', - 'timeout': 5, + 'timeout': 45, } PARKINGLOT_2: ParkingLotArgs = { 'id': 2, 'tenant_uuid': 'b93892f0-5300-4682-aede-3104b449ba69', 'name': 'Second Parking', - 'extension': 600, + 'extension': '600', 'slots_start': '601', 'slots_end': '602', 'timeout': 0, @@ -116,14 +116,13 @@ def given_parked_call( self, parking_extension: str, *, - tenant_uuid: str | None = VALID_TENANT, + tenant_uuid: str | None = None, user_uuid: str | None = None, ) -> Generator[str, None, None]: - variables = {} - if tenant_uuid: - variables['WAZO_TENANT_UUID'] = tenant_uuid - if user_uuid: - variables['WAZO_USERUUID'] = user_uuid + variables = { + 'WAZO_TENANT_UUID': tenant_uuid or VALID_TENANT, + 'WAZO_USERUUID': user_uuid or random_uuid(), + } channel = self.ari.channels.originate( endpoint=ENDPOINT_AUTOANSWER,