From 146cbdaffdd1b551e6689f162e26226d5a351d6e Mon Sep 17 00:00:00 2001 From: Twist Date: Mon, 22 Aug 2022 18:00:37 +0100 Subject: Add co_authors property to the Commit object, which parses the commit message for designated co-authors, include a simple test. --- test/test_commit.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/test_commit.py') diff --git a/test/test_commit.py b/test/test_commit.py index 82126987..cf8e1db6 100644 --- a/test/test_commit.py +++ b/test/test_commit.py @@ -509,3 +509,14 @@ JzJMZDRLQLFvnzqZuCjE assert KEY_1 not in commit.trailers.keys() assert KEY_2 in commit.trailers.keys() assert commit.trailers[KEY_2] == VALUE_2 + + def test_commit_co_authors(self): + commit = copy.copy(self.rorepo.commit("4251bd5")) + commit.message = """Commit message + +Co-authored-by: Test User 1 <602352+test@users.noreply.github.com> +Co-authored-by: test_user_2 """ + assert commit.co_authors == [ + Actor("Test User 1", "602352+test@users.noreply.github.com"), + Actor("test_user_2", "another_user-email@.github.com"), + ] -- cgit v1.2.1 From 3cb7ecf4e03c599d9e6f0b2416082025d3fa849a Mon Sep 17 00:00:00 2001 From: Twist Date: Tue, 23 Aug 2022 19:50:00 +0100 Subject: Add malformed co-authors to the test, to check they aren't detected with the regex. --- test/test_commit.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'test/test_commit.py') diff --git a/test/test_commit.py b/test/test_commit.py index cf8e1db6..a08ac39b 100644 --- a/test/test_commit.py +++ b/test/test_commit.py @@ -515,8 +515,12 @@ JzJMZDRLQLFvnzqZuCjE commit.message = """Commit message Co-authored-by: Test User 1 <602352+test@users.noreply.github.com> -Co-authored-by: test_user_2 """ +Co-authored-by: test_user_2 +Co_authored_by: test_user_x +Co-authored-by: test_user_y +Co-authored-by: test_user_3 """ assert commit.co_authors == [ Actor("Test User 1", "602352+test@users.noreply.github.com"), - Actor("test_user_2", "another_user-email@.github.com"), + Actor("test_user_2", "another_user-email@github.com"), + Actor("test_user_3", "test_user_3@github.com"), ] -- cgit v1.2.1 From 09f8a1b7b674d6138b872643b13ffc5444fab24f Mon Sep 17 00:00:00 2001 From: Twist Date: Wed, 24 Aug 2022 19:05:45 +0100 Subject: Use the same regex as the Actor class when determining co-authors. --- test/test_commit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/test_commit.py') diff --git a/test/test_commit.py b/test/test_commit.py index a08ac39b..c5a43c94 100644 --- a/test/test_commit.py +++ b/test/test_commit.py @@ -517,7 +517,7 @@ JzJMZDRLQLFvnzqZuCjE Co-authored-by: Test User 1 <602352+test@users.noreply.github.com> Co-authored-by: test_user_2 Co_authored_by: test_user_x -Co-authored-by: test_user_y +Co-authored-by: test_user_y text Co-authored-by: test_user_3 """ assert commit.co_authors == [ Actor("Test User 1", "602352+test@users.noreply.github.com"), -- cgit v1.2.1