Skip to content

Commit

Permalink
Zendesk form details (#23)
Browse files Browse the repository at this point in the history
* rudimentary changes to Zendesk feed to allow the getting of a Zendesk form's details.

* add workflows for testing later versions of python

* updated zendesk test to reflect test users' changed details

* Update pytest 3.10.yml

* surface ticket form ID field
  • Loading branch information
Ctri-The-Third authored Mar 27, 2023
1 parent ce272b4 commit dc53a79
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions serviceHelpers/models/ZendeskTicket.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def __init__(self, host) -> None:
self.comments = []
self.logger = logging.getLogger("zendeskHelper.zendeskTicket")
self.custom_fields = {}
self.ticket_form_id = 0
pass

def from_string(self, str):
Expand Down Expand Up @@ -73,6 +74,7 @@ def from_dict(self, source: dict):
self.group_id = source["group_id"] if "group_id" in source else self.group_id
self.status = source["status"] if "status" in source else self.status
self.priority = source["priority"] if "priority" in source else self.priority
self.ticket_form_id = source["ticket_form_id"] if "ticket_form_id" in source else self.ticket_form_id
for custom_field in source["custom_fields"]:
try:
if custom_field["value"] is not None:
Expand All @@ -92,5 +94,6 @@ def __str__(self) -> str:
"assignee_id": self.assignee_id,
"requester_id": self.requester_id,
"group_id": self.group_id,
"ticket_form_id" : self.ticket_form_id
}
return json.dumps(dict, sort_keys=True)
8 changes: 8 additions & 0 deletions tests/test_zendesk.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,15 @@ def test_custom_fields():
isinstance(ticket.custom_fields[field_id], (bool, str))
assert True

def test_get_form_id_in_ticket():
zend = zendesk(ZENDESK_HOST, ZENDESK_KEY)
target_id = 1239674

tickets = zend.search_for_tickets(f"{target_id}")
ticket = tickets[1239674]
ticket: ZendeskTicket

assert ticket.ticket_form_id is not 0

def test_get_form_details():
"fetches a test form and checks that the returned name matches the expected value"
Expand Down

0 comments on commit dc53a79

Please sign in to comment.