Skip to content

Commit

Permalink
add: test case: all ignored users
Browse files Browse the repository at this point in the history
  • Loading branch information
Okabe-Junya committed Jul 31, 2023
1 parent afac3c0 commit 0c03676
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test_time_to_first_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,31 @@ def test_measure_time_to_first_response_ignore_users(self):
# Check the results
self.assertEqual(result, expected_result)

def test_measure_time_to_first_response_only_ignored_users(self):
"""Test that measure_time_to_first_response returns empty for an issue with only ignored users."""
# Set up the mock GitHub issues
mock_issue1 = MagicMock()
mock_issue1.comments = 1
mock_issue1.created_at = "2023-01-01T00:00:00Z"

# Set up the mock GitHub comments (all ignored)
mock_comment1 = MagicMock()
mock_comment1.user.login = "ignored_user"
mock_comment1.created_at = datetime.fromisoformat("2023-01-02T00:00:00Z")

mock_comment2 = MagicMock()
mock_comment2.user.login = "ignored_user2"
mock_comment2.created_at = datetime.fromisoformat("2023-01-03T00:00:00Z")

mock_issue1.issue.comments.return_value = [mock_comment1, mock_comment2]

# Call the function
result = measure_time_to_first_response(mock_issue1, None, ["ignored_user", "ignored_user2"])
expected_result = None

# Check the results
self.assertEqual(result, expected_result)


class TestGetAverageTimeToFirstResponse(unittest.TestCase):
"""Test the get_average_time_to_first_response function."""
Expand Down

0 comments on commit 0c03676

Please sign in to comment.