harvest_issues/tests.py
2023-10-04 09:13:00 -07:00

36 lines
1.8 KiB
Python

import generate_issues
import re
def test_split_issues_into_columns():
issues_string = 'Resolved Issue #363, #362 and Issue 361'
issues = generate_issues.parse_notes_section(issues_string)
solution = {'First Issue Title': 'Little slow downs are happening - these often signal that the server memory is getting overwhelmed?', 'First Issue URL': 'https://git.agaric.com/housingworks/app-housingworks-net/issues/363', 'Second Issue Title': 'Little slow downs are happening - these often signal that the server memory is getting overwhelmed?', 'Second Issue URL': 'https://git.agaric.com/housingworks/app-housingworks-net/issues/363', 'Third Issue Title': 'the csv Importer has quit working on both the live and test sites???', 'Third Issue URL': 'https://git.agaric.com/housingworks/app-housingworks-net/issues/362'}
if (generate_issues.split_issues_into_columns(issues) == solution):
print("TEST SPLIT ISSUES INTO COLUMNS PASSED")
else:
print("TEST SPLIT ISSUES INTO COLUMNS FAILED")
def test_parse_notes_section():
if (generate_issues.parse_notes_section('Resolved Issue #4, #5 and Issue 6') == ['4', '5', '6']):
print("TEST PARSE NOTES SECTION PASSED")
else:
print("TEST PARSE NOTES SECTION FAILED")
def test_get_issue_title_and_url():
solution = [
"Little slow downs are happening - these often signal that the server memory is getting overwhelmed?",
"https://git.agaric.com/housingworks/app-housingworks-net/issues/363"
]
if generate_issues.get_issue_title_and_url(363) == solution:
print("TEST GET ISSUE TITLE AND URL PASSED")
else:
print("TEST GET ISSUE TITLE AND URL FAILED")
def run_tests():
test_parse_notes_section()
test_get_issue_title_and_url()
test_split_issues_into_columns()
run_tests()