Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cgundy committed Dec 16, 2024
1 parent 057ccd4 commit 4a18bf3
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions reusable_workflows/tests/test_cla_pr.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
from unittest import mock

import github3
import pytest

from shared.messages import (
Expand Down Expand Up @@ -308,3 +309,29 @@ def test_github_token_not_passed_in(github_login_mock):
assert (
str(exc.value) == "github login failed - maybe GH_TOKEN was not correctly set"
)

@pytest.mark.integration
def test_cla_signed():
gh = github3.login(token=os.getenv("GH_TOKEN"))
cla = CLAHandler(gh)
issue = cla.get_cla_issue("droid-uexternal")

# because the issue can change states, we don't check the status, just that it throws no errors
cla.check_if_cla_signed(issue, "droid-uexternal")

@pytest.mark.integration
def get_cla_issue():
gh = github3.login(token=os.getenv("GH_TOKEN"))
cla = CLAHandler(gh)
issue = cla.get_cla_issue("droid-uexternal")

assert issue is not None
assert issue.title == "cla: @droid-uexternal"

@pytest.mark.integration
def test_pr_comments_accessible():
gh = github3.login(token=os.getenv("GH_TOKEN"))
pr = gh.pull_request("dfinity", "test-compliant-repository-public", 4)
comments = pr.issue_comments()

assert len(comments) > 0

0 comments on commit 4a18bf3

Please sign in to comment.