Skip to content

Commit

Permalink
updating a few test cases. everything looks good. formatting ready fo…
Browse files Browse the repository at this point in the history
…r review
  • Loading branch information
Paul Philion committed Mar 10, 2024
1 parent 737d0d1 commit 19a29f9
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ def format_ticket_details(self, ticket:Ticket) -> str:
# ### Description
# description text
#link_padding = ' ' * (5 - len(str(ticket.id))) # field width = 6
status = f"{EMOJI[ticket.status.name]} {ticket.status.name}"
priority = f"{EMOJI[ticket.priority.name]} {ticket.priority.name}"
status = f"{EMOJI[ticket.status.name]} {ticket.status}"
priority = f"{EMOJI[ticket.priority.name]} {ticket.priority}"
created_age = synctime.age_str(ticket.created_on)
updated_age = synctime.age_str(ticket.updated_on)
assigned = ticket.assigned_to.name if ticket.assigned_to else ""
Expand Down
2 changes: 1 addition & 1 deletion netbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ async def synchronize_ticket(self, ticket, thread:discord.Thread) -> bool:
for note in redmine_notes:
# Write the note to the discord thread
dirty_flag = True
await thread.send(self.format_discord_note(note))
await thread.send(self.formatter.format_discord_note(note))
log.debug(f"synced {len(redmine_notes)} notes from #{ticket.id} --> {thread}")

# get the new notes from discord
Expand Down
4 changes: 2 additions & 2 deletions test_cog_tickets.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def setUp(self):


def parse_markdown_link(self, text:str) -> tuple[str, str]:
regex = r"^\[(\d+)\]\((.+)\)"
m = re.match(regex, text)
regex = r"\[`#(\d+)`\]\((.+)\)"
m = re.search(regex, text)
self.assertIsNotNone(m, f"could not find ticket number in response str: {text}")

ticket_id = m.group(1)
Expand Down
3 changes: 2 additions & 1 deletion test_netbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from dotenv import load_dotenv

import netbot
from formatting import MAX_MESSAGE_LEN

import test_utils

Expand Down Expand Up @@ -94,7 +95,7 @@ async def test_sync_ticket_long_message(self):
# assert method send called on mock thread, with the correct values
log.debug(f"### call args: {thread.send.call_args}")
self.assertIn(self.tag, thread.send.call_args.args[0])
self.assertLessEqual(len(thread.send.call_args.args[0]), netbot.MAX_MESSAGE_LEN, "Message sent to Discord is too long")
self.assertLessEqual(len(thread.send.call_args.args[0]), MAX_MESSAGE_LEN, "Message sent to Discord is too long")

# clean up
self.redmine.remove_ticket(ticket.id)
Expand Down
1 change: 1 addition & 0 deletions test_redmine.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def test_blocked_create_ticket(self):
self.assertFalse(self.user_mgr.is_blocked(self.user))


@unittest.skip("takes too long and fills the log with junk")
def test_client_timeout(self):
# construct an invalid client to try to get a timeout
try:
Expand Down

0 comments on commit 19a29f9

Please sign in to comment.