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() 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