Skip to content

Commit

Permalink
Simplify PR #222 (#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
webbnh authored Dec 6, 2024
1 parent 0ccc143 commit 6f16199
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
14 changes: 6 additions & 8 deletions sync2jira/downstream_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,17 @@
#
# Authors: Ralph Bean <[email protected]>

# Build-In Modules
import operator
# Python Standard Library Modules
from datetime import datetime, timezone
import difflib
import logging
import operator
import re
import difflib

# 3rd Party Modules
import arrow
import jira.client
from jira import JIRAError
from datetime import datetime
from zoneinfo import ZoneInfo
import jira.client
import jinja2
import pypandoc

Expand All @@ -38,8 +37,7 @@

# The date the service was upgraded
# This is used to ensure legacy comments are not touched
UTC = ZoneInfo(key='UTC')
UPDATE_DATE = datetime(2019, 7, 9, 18, 18, 36, 480291, UTC)
UPDATE_DATE = datetime(2019, 7, 9, 18, 18, 36, 480291, tzinfo=timezone.utc)

log = logging.getLogger('sync2jira')

Expand Down
13 changes: 5 additions & 8 deletions tests/test_downstream_issue.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import unittest
import unittest.mock as mock
from unittest.mock import MagicMock
from datetime import datetime
from zoneinfo import ZoneInfo
from datetime import datetime, timezone

import sync2jira.downstream_issue as d
from sync2jira.intermediary import Issue
Expand All @@ -12,8 +11,6 @@

PATH = 'sync2jira.downstream_issue.'

UTC = ZoneInfo(key='UTC')


class TestDownstreamIssue(unittest.TestCase):
"""
Expand Down Expand Up @@ -1494,7 +1491,7 @@ def test_find_comment_in_jira_legacy(self,
mock_jira_comment.raw = {'body': 'mock_legacy_comment_body'}
mock_comment = {
'id': '12345',
'date_created': datetime(2019, 8, 8, 0, 0, 0, 0, UTC)
'date_created': datetime(2019, 8, 8, tzinfo=timezone.utc)
}

# Call the function
Expand All @@ -1520,7 +1517,7 @@ def test_find_comment_in_jira_id(self,
mock_jira_comment.raw = {'body': '12345'}
mock_comment = {
'id': '12345',
'date_created': datetime(2019, 8, 8, 0, 0, 0, 0, UTC)
'date_created': datetime(2019, 8, 8, tzinfo=timezone.utc)
}

# Call the function
Expand All @@ -1546,7 +1543,7 @@ def test_find_comment_in_jira_old_comment(self,
mock_jira_comment.raw = {'body': 'old_comment'}
mock_comment = {
'id': '12345',
'date_created': datetime(2019, 1, 1, 0, 0, 0, 0, UTC)
'date_created': datetime(2019, 1, 1, tzinfo=timezone.utc)
}

# Call the function
Expand All @@ -1570,7 +1567,7 @@ def test_find_comment_in_jira_none(self,
mock_comment_format_legacy.return_value = 'mock_legacy_comment_body'
mock_comment = {
'id': '12345',
'date_created': datetime(2019, 1, 1, 0, 0, 0, 0, UTC)
'date_created': datetime(2019, 1, 1, tzinfo=timezone.utc)
}

# Call the function
Expand Down

0 comments on commit 6f16199

Please sign in to comment.