harvest_issues/tests.py

48 lines
1.7 KiB
Python
Raw Normal View History

2023-10-04 16:13:00 +00:00
import generate_issues
import re
2023-10-04 16:13:00 +00:00
def test_split_issues_into_columns():
issues_string = "Resolved Issue #679, #678 and Issue 677"
2023-10-04 16:13:00 +00:00
issues = generate_issues.parse_notes_section(issues_string)
solution = {
"First Issue Title": "Update 'Same as mailing address' label in step 1 of client wizard",
"First Issue URL": "https://git.agaric.com/housingworks/app-housingworks-net/issues/679",
"Second Issue Title": "People filtering the programs listing by county can see which state the county is in",
"Second Issue URL": "https://git.agaric.com/housingworks/app-housingworks-net/issues/678",
"Third Issue Title": "Fatal error on viewing Client Households",
"Third Issue URL": "https://git.agaric.com/housingworks/app-housingworks-net/issues/677",
}
2023-10-04 16:13:00 +00:00
if generate_issues.split_issues_into_columns(issues) == solution:
2023-10-04 16:13:00 +00:00
print("TEST SPLIT ISSUES INTO COLUMNS PASSED")
else:
print("TEST SPLIT ISSUES INTO COLUMNS FAILED")
2023-10-04 16:13:00 +00:00
def test_parse_notes_section():
if generate_issues.parse_notes_section("Resolved Issue #4, #5 and Issue 6") == ["4","5","6"]:
2023-10-04 16:13:00 +00:00
print("TEST PARSE NOTES SECTION PASSED")
else:
print("TEST PARSE NOTES SECTION FAILED")
2023-10-04 16:13:00 +00:00
def test_get_issue_title_and_url():
solution = [
"Update 'Same as mailing address' label in step 1 of client wizard",
"https://git.agaric.com/housingworks/app-housingworks-net/issues/679",
2023-10-04 16:13:00 +00:00
]
if generate_issues.get_issue_title_and_url(679) == solution:
2023-10-04 16:13:00 +00:00
print("TEST GET ISSUE TITLE AND URL PASSED")
else:
print("TEST GET ISSUE TITLE AND URL FAILED")
2023-10-04 16:13:00 +00:00
def run_tests():
test_parse_notes_section()
test_get_issue_title_and_url()
test_split_issues_into_columns()
run_tests()