-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from Ctri-The-Third/Zendesk_custom_fields
Zendesk custom fields
- Loading branch information
Showing
3 changed files
with
37 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
ZendeskOrganisation, | ||
ZendeskUser, | ||
ZendeskWorklog, | ||
ZendeskTicket, | ||
) | ||
|
||
ZENDESK_HOST = os.environ.get("ZENDESK_HOST") | ||
|
@@ -131,14 +132,18 @@ def test_user_init_and_invalid_handling(caplog): | |
def test_search_for_tickets(caplog): | ||
"Check for tickets belonging to a specific group" | ||
zend = zendesk(ZENDESK_HOST, ZENDESK_KEY) | ||
search_str = "requester:[email protected]" | ||
search_str = "1239674" | ||
|
||
tickets = zend.search_for_tickets(search_string=search_str) | ||
|
||
assert len(tickets) > 0 | ||
|
||
for entry in caplog.records: | ||
assert entry.levelno < logging.ERROR | ||
|
||
for _, ticket in tickets.items(): | ||
assert isinstance(ticket, ZendeskTicket) | ||
|
||
|
||
def test_worklog_parse(): | ||
"check that if missing fields aren't supplied, the worklog is not reported as valid" | ||
|
@@ -171,3 +176,20 @@ def test_get_worklogs_from_audit(caplog): | |
assert len(logs) > 0 | ||
for entry in caplog.records: | ||
assert entry.levelno < logging.ERROR | ||
|
||
|
||
def test_custom_fields(): | ||
"Fetches a test ticket and checks that there are appropriate custom fields populated" | ||
|
||
target_id = 1239674 | ||
|
||
zend = zendesk(ZENDESK_HOST, ZENDESK_KEY) | ||
|
||
tickets = zend.search_for_tickets(f"{target_id}") | ||
ticket = tickets[1239674] | ||
ticket: ZendeskTicket | ||
|
||
assert isinstance(ticket.custom_fields, dict) | ||
for field_id in ticket.custom_fields: | ||
isinstance(ticket.custom_fields[field_id], (bool, str)) | ||
assert True |