Skip to content

Commit

Permalink
add test checking iteration interface
Browse files Browse the repository at this point in the history
Signed-off-by: flashdagger <flashdagger@googlemail.com>
  • Loading branch information
flashdagger committed Oct 28, 2023
1 parent 856bee5 commit 855ff18
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/test_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ def test_role_update(rclient):
assert role.name == "Clone: Customer"
updated_role = role.update(active=False)
assert updated_role.active is False


def test_role_iteration(rclient):
roles = tuple(rclient.roles)
assert len(roles) > 2
assert tuple(rclient.roles.iter(page=None, per_page=1)) == roles
10 changes: 10 additions & 0 deletions tests/test_roles/test_role_iteration.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{"method": "GET", "url": "https://localhost/api/v1/roles?page=1&per_page=10&expand=false", "status_code": 200, "reason": "OK", "headers": {"Content-Type": "application/json; charset=utf-8", "Content-Length": "958"}, "encoding": "utf-8", "content_size": 958}
[{"id":1,"name":"Admin","preferences":{},"default_at_signup":false,"active":true,"note":"To configure your system.","updated_by_id":3,"created_by_id":1,"created_at":"2023-09-22T20:15:52.702Z","updated_at":"2023-10-19T02:03:18.114Z","permission_ids":[1,43,55,65],"knowledge_base_permission_ids":[],"group_ids":{}},{"id":2,"name":"Agent","preferences":{},"default_at_signup":false,"active":true,"note":"To work on Tickets.","updated_by_id":3,"created_by_id":1,"created_at":"2023-09-22T20:15:52.728Z","updated_at":"2023-10-19T02:03:18.117Z","permission_ids":[43,57,60,62,66],"knowledge_base_permission_ids":[],"group_ids":{}},{"id":3,"name":"Customer","preferences":{},"default_at_signup":true,"active":true,"note":"People who create Tickets ask for help.","updated_by_id":3,"created_by_id":1,"created_at":"2023-09-22T20:15:52.744Z","updated_at":"2023-09-23T03:23:14.777Z","permission_ids":[44,47,48,50,54,58],"knowledge_base_permission_ids":[],"group_ids":{}}]
{"method": "GET", "url": "https://localhost/api/v1/roles?page=1&per_page=1&expand=false", "status_code": 200, "reason": "OK", "headers": {"Content-Type": "application/json; charset=utf-8", "Content-Length": "313"}, "encoding": "utf-8", "content_size": 313}
[{"id":1,"name":"Admin","preferences":{},"default_at_signup":false,"active":true,"note":"To configure your system.","updated_by_id":3,"created_by_id":1,"created_at":"2023-09-22T20:15:52.702Z","updated_at":"2023-10-19T02:03:18.114Z","permission_ids":[1,43,55,65],"knowledge_base_permission_ids":[],"group_ids":{}}]
{"method": "GET", "url": "https://localhost/api/v1/roles?page=2&per_page=1&expand=false", "status_code": 200, "reason": "OK", "headers": {"Content-Type": "application/json; charset=utf-8", "Content-Length": "311"}, "encoding": "utf-8", "content_size": 311}
[{"id":2,"name":"Agent","preferences":{},"default_at_signup":false,"active":true,"note":"To work on Tickets.","updated_by_id":3,"created_by_id":1,"created_at":"2023-09-22T20:15:52.728Z","updated_at":"2023-10-19T02:03:18.117Z","permission_ids":[43,57,60,62,66],"knowledge_base_permission_ids":[],"group_ids":{}}]
{"method": "GET", "url": "https://localhost/api/v1/roles?page=3&per_page=1&expand=false", "status_code": 200, "reason": "OK", "headers": {"Content-Type": "application/json; charset=utf-8", "Content-Length": "336"}, "encoding": "utf-8", "content_size": 336}
[{"id":3,"name":"Customer","preferences":{},"default_at_signup":true,"active":true,"note":"People who create Tickets ask for help.","updated_by_id":3,"created_by_id":1,"created_at":"2023-09-22T20:15:52.744Z","updated_at":"2023-09-23T03:23:14.777Z","permission_ids":[44,47,48,50,54,58],"knowledge_base_permission_ids":[],"group_ids":{}}]
{"method": "GET", "url": "https://localhost/api/v1/roles?page=4&per_page=1&expand=false", "status_code": 200, "reason": "OK", "headers": {"Content-Type": "application/json; charset=utf-8", "Content-Length": "2"}, "encoding": "utf-8", "content_size": 2}
[]

0 comments on commit 855ff18

Please sign in to comment.