diff --git a/serviceHelpers/models/ZendeskTicket.py b/serviceHelpers/models/ZendeskTicket.py index 0d455e7..99feac7 100644 --- a/serviceHelpers/models/ZendeskTicket.py +++ b/serviceHelpers/models/ZendeskTicket.py @@ -27,6 +27,7 @@ def __init__(self, host) -> None: self.requester = None self.group_id = 0 self.comments = [] + self.tags = [] self.logger = logging.getLogger("zendeskHelper.zendeskTicket") self.custom_fields = {} self.ticket_form_id = 0 @@ -63,6 +64,7 @@ def from_dict(self, source: dict): self.logger.error( "Date found but not parsed properly : %s", source["updated_at"] ) + self.tags = source["tags"] if "tags" in source else self.tags self.summary = source["subject"] if "subject" in source else self.summary self.desc = source["description"] if "description" in source else self.desc self.assignee_id = ( diff --git a/setup.py b/setup.py index 548ef82..f127bb9 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name="hex-helpers", - version="3.0.0", + version="3.0.1", description="A series of light helpers for `freshdesk`,`gmail`,`habitica`,`hue lights`,`jira`,`slack`,`trello`", long_description=README, long_description_content_type="text/markdown", diff --git a/tests/test_zendesk.py b/tests/test_zendesk.py index c5463fd..53508a7 100644 --- a/tests/test_zendesk.py +++ b/tests/test_zendesk.py @@ -82,7 +82,7 @@ def test_get_user(caplog): assert entry.levelno < logging.ERROR assert isinstance(user, ZendeskUser) - assert user.name == "test fg" + assert isinstance(user.name, str) assert user.email == "test@test.com" assert user.user_id == 417316391 assert user.organisationID is None @@ -160,6 +160,18 @@ def test_search_for_tickets(caplog): assert isinstance(ticket, ZendeskTicket) +def test_tags_included(caplog): + "Check that the tags are included in the ticket" + + zend = zendesk(ZENDESK_HOST, ZENDESK_KEY) + search_str = "1239674" + + tickets = zend.search_for_tickets(search_string=search_str) + for _, ticket in tickets.items(): + assert isinstance(ticket, ZendeskTicket) + assert len(ticket.tags) > 0 + + def test_worklog_parse(): "check that if missing fields aren't supplied, the worklog is not reported as valid" log = ZendeskWorklog()