2222 "SEARCH_QUERY" : "is:open repo:user/repo" ,
2323 "GH_TOKEN" : "test_token" ,
2424 "DRAFT_PR_TRACKING" : "True" ,
25+ "HIDE_CREATED_AT" : "False" ,
2526 },
2627)
2728class TestWriteToMarkdown (unittest .TestCase ):
@@ -44,6 +45,7 @@ def test_write_to_markdown(self):
4445 title = "Issue 1" ,
4546 html_url = "https://github.com/user/repo/issues/1" ,
4647 author = "alice" ,
48+ created_at = timedelta (days = - 5 ),
4749 time_to_first_response = timedelta (days = 1 ),
4850 time_to_close = timedelta (days = 2 ),
4951 time_to_answer = timedelta (days = 3 ),
@@ -54,6 +56,7 @@ def test_write_to_markdown(self):
5456 title = "Issue 2\r " ,
5557 html_url = "https://github.com/user/repo/issues/2" ,
5658 author = "bob" ,
59+ created_at = timedelta (days = - 5 ),
5760 time_to_first_response = timedelta (days = 3 ),
5861 time_to_close = timedelta (days = 4 ),
5962 time_to_answer = timedelta (days = 5 ),
@@ -129,12 +132,12 @@ def test_write_to_markdown(self):
129132 "| Number of most active mentors | 5 |\n "
130133 "| Total number of items created | 2 |\n \n "
131134 "| Title | URL | Author | Time to first response | Time to close |"
132- " Time to answer | Time in draft | Time spent in bug |\n "
133- "| --- | --- | --- | --- | --- | --- | --- | --- |\n "
135+ " Time to answer | Time in draft | Time spent in bug | Created At | \n "
136+ "| --- | --- | --- | --- | --- | --- | --- | --- | --- | \n "
134137 "| Issue 1 | https://github.com/user/repo/issues/1 | [alice](https://github.com/alice) | 1 day, 0:00:00 | "
135- "2 days, 0:00:00 | 3 days, 0:00:00 | 1 day, 0:00:00 | 4 days, 0:00:00 |\n "
138+ "2 days, 0:00:00 | 3 days, 0:00:00 | 1 day, 0:00:00 | 4 days, 0:00:00 | -5 days, 0:00:00 | \n "
136139 "| Issue 2 | https://github.com/user/repo/issues/2 | [bob](https://github.com/bob) | 3 days, 0:00:00 | "
137- "4 days, 0:00:00 | 5 days, 0:00:00 | 1 day, 0:00:00 | 2 days, 0:00:00 |\n \n "
140+ "4 days, 0:00:00 | 5 days, 0:00:00 | 1 day, 0:00:00 | 2 days, 0:00:00 | -5 days, 0:00:00 | \n \n "
138141 "_This report was generated with the [Issue Metrics Action](https://github.com/github/issue-metrics)_\n "
139142 "Search query used to find these items: `is:issue is:open label:bug`\n "
140143 )
@@ -156,6 +159,7 @@ def test_write_to_markdown_with_vertical_bar_in_title(self):
156159 title = "Issue 1" ,
157160 html_url = "https://github.com/user/repo/issues/1" ,
158161 author = "alice" ,
162+ created_at = timedelta (days = - 5 ),
159163 time_to_first_response = timedelta (days = 1 ),
160164 time_to_close = timedelta (days = 2 ),
161165 time_to_answer = timedelta (days = 3 ),
@@ -166,6 +170,7 @@ def test_write_to_markdown_with_vertical_bar_in_title(self):
166170 title = "feat| Issue 2" , # title contains a vertical bar
167171 html_url = "https://github.com/user/repo/issues/2" ,
168172 author = "bob" ,
173+ created_at = timedelta (days = - 5 ),
169174 time_to_first_response = timedelta (days = 3 ),
170175 time_to_close = timedelta (days = 4 ),
171176 time_to_answer = timedelta (days = 5 ),
@@ -238,12 +243,12 @@ def test_write_to_markdown_with_vertical_bar_in_title(self):
238243 "| Number of most active mentors | 5 |\n "
239244 "| Total number of items created | 2 |\n \n "
240245 "| Title | URL | Author | Time to first response | Time to close |"
241- " Time to answer | Time in draft | Time spent in bug |\n "
242- "| --- | --- | --- | --- | --- | --- | --- | --- |\n "
246+ " Time to answer | Time in draft | Time spent in bug | Created At | \n "
247+ "| --- | --- | --- | --- | --- | --- | --- | --- | --- | \n "
243248 "| Issue 1 | https://github.com/user/repo/issues/1 | [alice](https://github.com/alice) | 1 day, 0:00:00 | "
244- "2 days, 0:00:00 | 3 days, 0:00:00 | 1 day, 0:00:00 | 1 day, 0:00:00 |\n "
249+ "2 days, 0:00:00 | 3 days, 0:00:00 | 1 day, 0:00:00 | 1 day, 0:00:00 | -5 days, 0:00:00 | \n "
245250 "| feat| Issue 2 | https://github.com/user/repo/issues/2 | [bob](https://github.com/bob) | 3 days, 0:00:00 | "
246- "4 days, 0:00:00 | 5 days, 0:00:00 | None | 2 days, 0:00:00 |\n \n "
251+ "4 days, 0:00:00 | 5 days, 0:00:00 | None | 2 days, 0:00:00 | -5 days, 0:00:00 | \n \n "
247252 "_This report was generated with the [Issue Metrics Action](https://github.com/github/issue-metrics)_\n "
248253 )
249254 self .assertEqual (content , expected_content )
@@ -287,6 +292,7 @@ def test_write_to_markdown_no_issues(self):
287292 {
288293 "SEARCH_QUERY" : "is:open repo:user/repo" ,
289294 "GH_TOKEN" : "test_token" ,
295+ "HIDE_CREATED_AT" : "False" ,
290296 "HIDE_TIME_TO_FIRST_RESPONSE" : "True" ,
291297 "HIDE_TIME_TO_CLOSE" : "True" ,
292298 "HIDE_TIME_TO_ANSWER" : "True" ,
@@ -309,6 +315,7 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self):
309315 title = "Issue 1" ,
310316 html_url = "https://github.com/user/repo/issues/1" ,
311317 author = "alice" ,
318+ created_at = timedelta (days = - 5 ),
312319 time_to_first_response = timedelta (minutes = 10 ),
313320 time_to_close = timedelta (days = 1 ),
314321 time_to_answer = timedelta (hours = 2 ),
@@ -321,6 +328,7 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self):
321328 title = "Issue 2" ,
322329 html_url = "https://github.com/user/repo/issues/2" ,
323330 author = "bob" ,
331+ created_at = timedelta (days = - 5 ),
324332 time_to_first_response = timedelta (minutes = 20 ),
325333 time_to_close = timedelta (days = 2 ),
326334 time_to_answer = timedelta (hours = 4 ),
@@ -363,17 +371,18 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self):
363371 # Check that the function writes the correct markdown file
364372 with open ("issue_metrics.md" , "r" , encoding = "utf-8" ) as file :
365373 content = file .read ()
374+
366375 expected_content = (
367376 "# Issue Metrics\n \n "
368377 "| Metric | Count |\n "
369378 "| --- | ---: |\n "
370379 "| Number of items that remain open | 2 |\n "
371380 "| Number of most active mentors | 5 |\n "
372381 "| Total number of items created | 2 |\n \n "
373- "| Title | URL | Author |\n "
374- "| --- | --- | --- |\n "
375- "| Issue 1 | https://www.github.com/user/repo/issues/1 | [alice](https://github.com/alice) |\n "
376- "| Issue 2 | https://www.github.com/user/repo/issues/2 | [bob](https://github.com/bob) |\n \n "
382+ "| Title | URL | Author | Created At | \n "
383+ "| --- | --- | --- | --- | \n "
384+ "| Issue 1 | https://www.github.com/user/repo/issues/1 | [alice](https://github.com/alice) | -5 days, 0:00:00 | \n "
385+ "| Issue 2 | https://www.github.com/user/repo/issues/2 | [bob](https://github.com/bob) | -5 days, 0:00:00 | \n \n "
377386 "_This report was generated with the [Issue Metrics Action](https://github.com/github/issue-metrics)_\n "
378387 "Search query used to find these items: `repo:user/repo is:issue`\n "
379388 )
0 commit comments