From 109f80f07f8b884bfe921af35c6a958ec1b6c48f Mon Sep 17 00:00:00 2001 From: Remy Bienvenu Date: Wed, 6 Nov 2024 07:41:10 -0800 Subject: [PATCH 1/2] incalls: Add user_id parameter to get endpoint documentation WAZO-3423 --- wazo_confd/plugins/api/api.yml | 6 ++++++ wazo_confd/plugins/incall/api.yml | 1 + 2 files changed, 7 insertions(+) diff --git a/wazo_confd/plugins/api/api.yml b/wazo_confd/plugins/api/api.yml index 6e2539ec7..2d8eda757 100644 --- a/wazo_confd/plugins/api/api.yml +++ b/wazo_confd/plugins/api/api.yml @@ -54,6 +54,12 @@ parameters: name: agent_id in: path description: Agent’s ID + userid: + required: false + type: integer + name: user_id + in: query + description: the user's ID useruuid: required: true type: string diff --git a/wazo_confd/plugins/incall/api.yml b/wazo_confd/plugins/incall/api.yml index d1ab6812d..a35a15a02 100644 --- a/wazo_confd/plugins/incall/api.yml +++ b/wazo_confd/plugins/incall/api.yml @@ -14,6 +14,7 @@ paths: - $ref: '#/parameters/limit' - $ref: '#/parameters/offset' - $ref: '#/parameters/search' + - $ref: '#/parameters/userid' responses: '200': description: Incoming calls list From 398b07d403e7593445a88408edf512035498b9e0 Mon Sep 17 00:00:00 2001 From: Remy Bienvenu Date: Mon, 16 Dec 2024 10:44:53 +0100 Subject: [PATCH 2/2] test incalls: filtering by user_id WAZO-3423 --- integration_tests/suite/base/test_incalls.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/integration_tests/suite/base/test_incalls.py b/integration_tests/suite/base/test_incalls.py index 1ca9237ab..f801c6214 100644 --- a/integration_tests/suite/base/test_incalls.py +++ b/integration_tests/suite/base/test_incalls.py @@ -147,6 +147,26 @@ def test_sorting_offset_limit(incall1, incall2): s.check_limit(url, incall1, incall2, 'description', 'sort') +@fixtures.incall(id=0) +@fixtures.user(id=0) +@fixtures.incall(id=1) +@fixtures.user(id=1) +def test_list_by_user_id(incall, user1, *_): + with a.incall_user(incall, user1): + response = confd.incalls().get() + assert_that(response.total, 2) + + response = confd.incalls().get(user_id=user1['id']) + assert_that(response.total, 1) + assert_that( + response.items[0], + has_entry( + 'destination', + has_entry('user_id', user1['id']), + ), + ) + + @fixtures.incall() def test_get(incall): response = confd.incalls(incall['id']).get()