Skip to content

Commit c7bf2dd

Browse files
Update the test coverage
Signed-off-by: Lukasz Gryglicki <[email protected]> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot)
1 parent 29fd429 commit c7bf2dd

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

cla-backend/cla/tests/unit/test_github_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def test_get_co_author_commits_invalid_gh_email(self, mock_github_instance):
6464
installation_id = 123
6565

6666
# Call the function
67-
result = get_co_author_commits(co_author,commit, pr, installation_id)
67+
result, _ = get_co_author_commits(co_author,commit, pr, installation_id)
6868

6969
# Assertions
7070
self.assertEqual(result.commit_sha, "fake_sha")
@@ -87,7 +87,7 @@ def test_get_co_author_commits_valid_gh_email(self, mock_github_instance):
8787
installation_id = 123
8888

8989
# Call the function
90-
result = get_co_author_commits(co_author,commit, pr, installation_id)
90+
result, _ = get_co_author_commits(co_author,commit, pr, installation_id)
9191

9292
# Assertions
9393
self.assertEqual(result.commit_sha, "fake_sha")

cla-backend/cla/tests/unit/test_user_commit_summary.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_user_commit_summary_get_comment_body(self) -> None:
3636
m = UserCommitSummary("some_other_sha", 123456, 'login_value2', 'author name2', '[email protected]', False, False)
3737
missing = [m]
3838

39-
body = get_comment_body('github', 'https://foo.com', signed, missing)
39+
body = get_comment_body('github', 'https://foo.com', signed, missing, False)
4040
self.assertTrue(':white_check_mark:' in body)
4141
self.assertTrue(':x:' in body)
4242

@@ -47,7 +47,7 @@ def test_user_commit_summary_tag_not_in_get_comment_body(self) -> None:
4747

4848
missing = []
4949

50-
body = get_comment_body('github', 'https://foo.com', signed, missing)
50+
body = get_comment_body('github', 'https://foo.com', signed, missing, False)
5151
self.assertTrue(':white_check_mark:' in body)
5252
self.assertTrue('login_value' in body)
5353
self.assertFalse('@login_value' in body) # users should not be tagged in signed use case
@@ -58,6 +58,19 @@ def test_user_commit_summary_tag_in_get_comment_body(self) -> None:
5858
m = UserCommitSummary("some_other_sha", 123456, 'login_value2', 'author name2', '[email protected]', False, False)
5959
missing = [m]
6060

61-
body = get_comment_body('github', 'https://foo.com', signed, missing)
61+
body = get_comment_body('github', 'https://foo.com', signed, missing, False)
6262
self.assertTrue(':x:' in body)
6363
self.assertTrue('@login_value2' in body) # users should be tagged in missing use case
64+
65+
def test_user_commit_summary_get_comment_body_missing_co_authors(self) -> None:
66+
s1 = UserCommitSummary("abc1234xyz-123", 1234, 'login_value', 'author name', '[email protected]', True, True)
67+
s2 = UserCommitSummary("abc1234xyz-456", 1234, 'login_value', 'author name', '[email protected]', True, True)
68+
signed = [s1, s2]
69+
70+
m = UserCommitSummary("some_other_sha", 123456, 'login_value2', 'author name2', '[email protected]', False, False)
71+
missing = [m]
72+
73+
body = get_comment_body('github', 'https://foo.com', signed, missing, True)
74+
self.assertTrue(':white_check_mark:' in body)
75+
self.assertTrue(':x:' in body)
76+
self.assertTrue('One or more co-authors of this pull request were not found' in body)

0 commit comments

Comments
 (0)