Skip to content

Commit

Permalink
Merge d99b1a2 into e8ff394
Browse files Browse the repository at this point in the history
  • Loading branch information
gforcada committed Apr 8, 2023
2 parents e8ff394 + d99b1a2 commit a12ed98
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 27 deletions.
8 changes: 4 additions & 4 deletions src/mr.roboto/src/mr/roboto/subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def __init__(self, event):
def run(self):
"""Check if all users involved in a pull request have signed the CLA"""
if self.repo_name in IGNORE_NO_AGREEMENT:
self.log('whitelisted for contributors agreement')
self.log('no need to sign contributors agreement')
return

json_data = self.get_json_commits()
Expand Down Expand Up @@ -352,7 +352,7 @@ def __init__(self, event):
def run(self):
"""If the pull request does not add a changelog entry, warn about it"""
if self.repo_name in IGNORE_NO_CHANGELOG:
self.log('whitelisted for changelog entries')
self.log('no need to have a changelog entry')
return

status = 'success'
Expand Down Expand Up @@ -425,7 +425,7 @@ def run(self):

def _plone_versions_targeted(self):
if self.repo_name in IGNORE_NO_TEST_NEEDED:
self.log('skip adding test warnings, repo whitelisted')
self.log('skip adding test warnings, repo ignored')
return []

target_branch = self.pull_request['base']['ref']
Expand Down Expand Up @@ -587,7 +587,7 @@ def _should_trigger_jobs(self):
pull_request_url = self.event.pull_request['html_url']
repo_name = pull_request_url.split('/')[-3]
if repo_name in IGNORE_NO_TEST_NEEDED:
self.log('skip triggering jenkins jobs, repo is whitelisted')
self.log('skip triggering jenkins jobs, repo is ignored')
return False

return '@jenkins-plone-org please run jobs' in self.event.comment['body']
Expand Down
10 changes: 5 additions & 5 deletions src/mr.roboto/src/mr/roboto/tests/test_changelog_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
'base': {'repo': {'name': 'Products.CMFPlone', 'owner': {'login': 'plone'}}},
}

WHITELISTED_REPO_PAYLOAD = copy.deepcopy(PAYLOAD)
WHITELISTED_REPO_PAYLOAD['base']['repo']['name'] = 'documentation'
IGNORED_REPO_PAYLOAD = copy.deepcopy(PAYLOAD)
IGNORED_REPO_PAYLOAD['base']['repo']['name'] = 'documentation'

DIFF_NO_CHANGELOG = """
diff --git a/src/mr.roboto/setup.py b/src/mr.roboto/setup.py
Expand Down Expand Up @@ -104,11 +104,11 @@ def content(self):
return self.data


def test_repo_whitelisted(caplog):
event = NewPullRequest(pull_request=WHITELISTED_REPO_PAYLOAD, request=MockRequest())
def test_repo_ignored(caplog):
event = NewPullRequest(pull_request=IGNORED_REPO_PAYLOAD, request=MockRequest())
caplog.set_level(logging.INFO)
WarnNoChangelogEntry(event)
assert 'whitelisted for changelog entries' in caplog.records[-1].msg
assert 'no need to have a changelog entry' in caplog.records[-1].msg


@patch('requests.get')
Expand Down
10 changes: 5 additions & 5 deletions src/mr.roboto/src/mr/roboto/tests/test_contributor_agreement.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
}
COLLECTIVE_PAYLOAD = copy.deepcopy(PAYLOAD)
COLLECTIVE_PAYLOAD['base']['repo']['owner']['login'] = 'collective'
WHITELISTED_PAYLOAD = copy.deepcopy(PAYLOAD)
WHITELISTED_PAYLOAD['base']['repo']['name'] = 'icalendar'
IGNORED_PAYLOAD = copy.deepcopy(PAYLOAD)
IGNORED_PAYLOAD['base']['repo']['name'] = 'icalendar'


class MockRequest:
Expand Down Expand Up @@ -176,9 +176,9 @@ def json(self):
assert 'Contributors Agreement report: success' in caplog.records[-1].msg


def test_whitelisted(caplog):
event = NewPullRequest(pull_request=WHITELISTED_PAYLOAD, request=MockRequest())
def test_ignored(caplog):
event = NewPullRequest(pull_request=IGNORED_PAYLOAD, request=MockRequest())
caplog.set_level(logging.INFO)
ContributorsAgreementSigned(event)

assert 'whitelisted for contributors agreement', caplog.records[-1].msg
assert 'no need to sign contributors agreement' in caplog.records[-1].msg
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
import pytest


WHITELISTED_PKG_PAYLOAD = copy.deepcopy(COMMENT_PAYLOAD)
WHITELISTED_PKG_PAYLOAD['comment'][
IGNORED_PKG_PAYLOAD = copy.deepcopy(COMMENT_PAYLOAD)
IGNORED_PKG_PAYLOAD['comment'][
'html_url'
] = 'https://github.com/plone/plone.releaser/pull/42#issuecomment-290382'
WHITELISTED_PKG_PAYLOAD['issue']['pull_request'][
IGNORED_PKG_PAYLOAD['issue']['pull_request'][
'html_url'
] = 'https://github.com/plone/plone.releaser/pull/1'

Expand Down Expand Up @@ -96,11 +96,11 @@ def test_short_url(roboto):
assert subscriber.short_url == 'plone/plone.api#42-290382'


def test_package_whitelisted_no_jobs_triggered(roboto, caplog):
def test_package_ignoed_no_jobs_triggered(roboto, caplog):
caplog.set_level(logging.INFO)
_subscriber(roboto, WHITELISTED_PKG_PAYLOAD, {})
_subscriber(roboto, IGNORED_PKG_PAYLOAD, {})
logger_record = caplog.records[-1].msg
assert 'skip triggering jenkins jobs, repo is whitelisted' in logger_record
assert 'skip triggering jenkins jobs, repo is ignored' in logger_record


def test_random_comment_no_jobs_triggered(roboto, caplog):
Expand Down
14 changes: 7 additions & 7 deletions src/mr.roboto/src/mr/roboto/tests/test_warn_pull_request_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
COREDEV_RANDOM_BRANCH_PAYLOAD = copy.deepcopy(COREDEV_PAYLOAD)
COREDEV_RANDOM_BRANCH_PAYLOAD['base']['ref'] = 'random'

WHITELISTED_REPO = copy.deepcopy(PAYLOAD)
WHITELISTED_REPO['html_url'] = 'https://github.com/plone/plone.releaser/pull/5'
WHITELISTED_REPO['base']['repo']['full_name'] = 'plone/plone.releaser'
WHITELISTED_REPO['base']['repo']['name'] = 'plone.releaser'
IGNORED_REPO = copy.deepcopy(PAYLOAD)
IGNORED_REPO['html_url'] = 'https://github.com/plone/plone.releaser/pull/5'
IGNORED_REPO['base']['repo']['full_name'] = 'plone/plone.releaser'
IGNORED_REPO['base']['repo']['name'] = 'plone.releaser'


class MockRequest:
Expand Down Expand Up @@ -138,11 +138,11 @@ def test_buildout_coredev_targeting_plone_release(caplog):
assert 'for plone 6.0 on python 3.9' in caplog.records[1].msg


def test_whitelisted(caplog):
def test_ignoed(caplog):
caplog.set_level(logging.INFO)
event = create_event({}, payload=WHITELISTED_REPO)
event = create_event({}, payload=IGNORED_REPO)
WarnTestsNeedToRun(event)
event.request.cleanup_sources()

assert len(caplog.records) == 1
assert 'skip adding test warnings, repo whitelisted' in caplog.records[0].msg
assert 'skip adding test warnings, repo ignored' in caplog.records[0].msg

0 comments on commit a12ed98

Please sign in to comment.