update test to ensure contributor info is accurately portrayed

This commit is contained in:
sommersoft 2021-09-22 10:48:56 -05:00
parent b8a7bd540f
commit d3606f519a

View file

@ -36,10 +36,23 @@ def mock_list_repos(*args, **kwargs):
]
# pylint: disable=unused-argument
def mock_get_contribs(*args):
"""Function to monkeypatch `update_cp_org_libraries.get_contributors()` to ensure
proper testing of usage. Monkeypatched `list_repos` will likely not produce results.
"""
contribs = ["test_user1", "test_user2"]
reviewers = ["test_reviewer1", "test_reviewer2"]
merged_pr_count = 4
return contribs, reviewers, merged_pr_count
def test_update_cp_org_libraries(monkeypatch):
"""Test main function of 'circuitpyton_libraries.py', without writing an output file."""
monkeypatch.setattr(common_funcs, "list_repos", mock_list_repos)
monkeypatch.setattr(update_cp_org_libraries, "get_contributors", mock_get_contribs)
update_cp_org_libraries.main()
@ -49,6 +62,7 @@ def test_update_cp_org_libraries_output_file(monkeypatch, tmp_path, capsys):
"""Test main funciton of 'update_cp_org_libraries.py', with writing an output file."""
monkeypatch.setattr(common_funcs, "list_repos", mock_list_repos)
monkeypatch.setattr(update_cp_org_libraries, "get_contributors", mock_get_contribs)
tmp_output_file = tmp_path / "output_test.txt"