Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cgundy committed Nov 22, 2023
1 parent faece68 commit 59361ac
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions reusable_workflows/tests/test_cla_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def test_create_cla_issue():
"cla: @username",
body=cla_agreement_message,
)
issue.add_labels.assert_called_with("cla:pending")


def test_handle_cla_signed_with_agreed_label():
Expand Down Expand Up @@ -171,6 +172,19 @@ def test_handle_cla_signed_with_pending_label():
issue.remove_label.assert_called_once()
issue.add_labels.assert_called_once()

def test_handle_cla_signed_with_new_pending_label():
issue = mock.Mock()
label = mock.Mock()
label.name = "cla:pending"
issue.original_labels = [label]
agreement_message = AGREED_MESSAGE.format("username")

cla = CLAHandler(mock.Mock())
cla.handle_cla_signed(issue, "username")

issue.create_comment.assert_called_with(agreement_message)
issue.remove_label.assert_called_once()
issue.add_labels.assert_called_once()

def test_handle_cla_signed_with_no_label(capfd):
issue = mock.Mock()
Expand Down

0 comments on commit 59361ac

Please sign in to comment.