Skip to content

Commit

Permalink
now extracting tags out of Zendesk (#25)
Browse files Browse the repository at this point in the history
* now extracting tags out of Zendesk
* Update test_zendesk to remove regularly changing thing
  • Loading branch information
Ctri-The-Third authored Jun 12, 2023
1 parent ea0dcb0 commit ee4b612
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions serviceHelpers/models/ZendeskTicket.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = (
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 13 additions & 1 deletion tests/test_zendesk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "[email protected]"
assert user.user_id == 417316391
assert user.organisationID is None
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit ee4b612

Please sign in to comment.