Skip to content

Commit

Permalink
fix integration tests
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
ja0x committed Apr 2, 2024
1 parent 4ae7e13 commit b8f2346
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion integration_tests/assets/etc/asterisk/res_parking.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ parkext = 500
context = parkings
parkedmusicclass = default
parkpos = 501-510
parkingtime = 5
parkingtime = 45
findslot = next
parkext_exclusive = yes

Expand Down
8 changes: 4 additions & 4 deletions integration_tests/suite/helpers/confd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -387,7 +387,7 @@ def to_dict(self) -> ParkingLotSchema:
{
'id': 1000,
'context': 'some-ctx',
'exten': str(self._extension),
'exten': self._extension,
}
]

Expand Down
19 changes: 9 additions & 10 deletions integration_tests/suite/test_parkings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit b8f2346

Please sign in to comment.