mirror of
https://github.com/ditkrg/todo-to-issue-action.git
synced 2026-01-22 22:06:43 +00:00
test: print message when issue URL has actually been inserted
Insertion of the URL is different from simply creating/updating the issue, so we want to have this level of output to ensure that as many file updates as expected are actually occurring. Note: The unit test is currently failing!
This commit is contained in:
parent
590a050199
commit
cd754de86c
1
main.py
1
main.py
@ -84,6 +84,7 @@ def process_diff(diff, client=Client(), insert_issue_urls=False, parser=TodoPars
|
|||||||
file_lines.insert(line_number + 1, new_line)
|
file_lines.insert(line_number + 1, new_line)
|
||||||
with open(raw_issue.file_name, 'w') as issue_file:
|
with open(raw_issue.file_name, 'w') as issue_file:
|
||||||
issue_file.writelines(file_lines)
|
issue_file.writelines(file_lines)
|
||||||
|
print('Issue URL successfully inserted', file=output)
|
||||||
elif status_code == 200:
|
elif status_code == 200:
|
||||||
print(f'Issue updated: #{new_issue_number} @ {client.get_issue_url(new_issue_number)}', file=output)
|
print(f'Issue updated: #{new_issue_number} @ {client.get_issue_url(new_issue_number)}', file=output)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -48,7 +48,7 @@ class IssueUrlInsertionTest(unittest.TestCase):
|
|||||||
# process the diffs
|
# process the diffs
|
||||||
process_diff(diff=self.diff_file, insert_issue_urls=True, parser=self.parser, output=output)
|
process_diff(diff=self.diff_file, insert_issue_urls=True, parser=self.parser, output=output)
|
||||||
# make sure the number of issue URL comments inserted is as expected
|
# make sure the number of issue URL comments inserted is as expected
|
||||||
self.assertEqual(output.getvalue().count('Issue created: #None @ N/A'), 82)
|
self.assertEqual(output.getvalue().count('Issue URL successfully inserted'), 82)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# return to original working directory to ensure we don't mess up other tests
|
# return to original working directory to ensure we don't mess up other tests
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user