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 )
@@ -309,6 +314,7 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self):
309314 title = "Issue 1" ,
310315 html_url = "https://github.com/user/repo/issues/1" ,
311316 author = "alice" ,
317+ created_at = timedelta (days = - 5 ),
312318 time_to_first_response = timedelta (minutes = 10 ),
313319 time_to_close = timedelta (days = 1 ),
314320 time_to_answer = timedelta (hours = 2 ),
@@ -321,6 +327,7 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self):
321327 title = "Issue 2" ,
322328 html_url = "https://github.com/user/repo/issues/2" ,
323329 author = "bob" ,
330+ created_at = timedelta (days = - 5 ),
324331 time_to_first_response = timedelta (minutes = 20 ),
325332 time_to_close = timedelta (days = 2 ),
326333 time_to_answer = timedelta (hours = 4 ),
@@ -363,17 +370,18 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self):
363370 # Check that the function writes the correct markdown file
364371 with open ("issue_metrics.md" , "r" , encoding = "utf-8" ) as file :
365372 content = file .read ()
373+
366374 expected_content = (
367375 "# Issue Metrics\n \n "
368376 "| Metric | Count |\n "
369377 "| --- | ---: |\n "
370378 "| Number of items that remain open | 2 |\n "
371379 "| Number of most active mentors | 5 |\n "
372380 "| 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 "
381+ "| Title | URL | Author | Created At | \n "
382+ "| --- | --- | --- | --- | \n "
383+ "| Issue 1 | https://www.github.com/user/repo/issues/1 | [alice](https://github.com/alice) | -5 days, 0:00:00 | \n "
384+ "| Issue 2 | https://www.github.com/user/repo/issues/2 | [bob](https://github.com/bob) | -5 days, 0:00:00 | \n \n "
377385 "_This report was generated with the [Issue Metrics Action](https://github.com/github/issue-metrics)_\n "
378386 "Search query used to find these items: `repo:user/repo is:issue`\n "
379387 )
0 commit comments