Skip to content

Commit

Permalink
v2.0.3 - closes #15
Browse files Browse the repository at this point in the history
  • Loading branch information
Justintime50 committed Oct 10, 2020
1 parent 25d04e0 commit a940a37
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## v2.0.3 (2020-10-10)

* Replaced `logger.warning` with `logger.error` as they were used incorrectly (closes #15)

## v2.0.2 (2020-10-10)

* Correcting references of "Pull Bug" to "Pullbug"
Expand Down
8 changes: 4 additions & 4 deletions pullbug/github_bug.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ def get_repos(cls, github_owner, github_context=''):
LOGGER.debug(repos_response.text)
if 'Not Found' in repos_response.text:
error = f'Could not retrieve GitHub repos due to bad parameter: {github_owner} | {github_context}.'
LOGGER.warning(error)
LOGGER.error(error)
raise ValueError(error)
LOGGER.info('GitHub repos retrieved!')
except requests.exceptions.RequestException as response_error:
LOGGER.warning(
LOGGER.error(
f'Could not retrieve GitHub repos: {response_error}'
)
raise requests.exceptions.RequestException(response_error)
Expand All @@ -78,13 +78,13 @@ def get_pull_requests(cls, repos, github_owner, github_state):
else:
continue
except requests.exceptions.RequestException as response_error:
LOGGER.warning(
LOGGER.error(
f'Could not retrieve GitHub pull requests for {repo["name"]}: {response_error}'
)
raise requests.exceptions.RequestException(response_error)
except TypeError:
error = f'Could not retrieve GitHub pull requests due to bad parameter: {github_owner} | {github_state}.' # noqa
LOGGER.warning(error)
LOGGER.error(error)
raise TypeError(error)
LOGGER.info('Pull requests retrieved!')
return pull_requests
Expand Down
4 changes: 2 additions & 2 deletions pullbug/gitlab_bug.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ def get_merge_requests(cls, gitlab_scope, gitlab_state):
LOGGER.info('GitLab merge requests retrieved!')
if 'does not have a valid value' in response.text:
error = f'Could not retrieve GitLab merge requests due to bad parameter: {gitlab_scope} | {gitlab_state}.' # noqa
LOGGER.warning(error)
LOGGER.error(error)
raise ValueError(error)
except requests.exceptions.RequestException as response_error:
LOGGER.warning(
LOGGER.error(
f'Could not retrieve GitLab merge requests: {response_error}'
)
raise requests.exceptions.RequestException(response_error)
Expand Down
4 changes: 2 additions & 2 deletions pullbug/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def rocketchat(cls, message):
requests.post(ROCKET_CHAT_URL, data={'text': message})
LOGGER.info('Rocket Chat message sent!')
except requests.exceptions.RequestException as rc_error:
LOGGER.warning(f'Could not send Rocket Chat message: {rc_error}')
LOGGER.error(f'Could not send Rocket Chat message: {rc_error}')
raise requests.exceptions.RequestException(rc_error)

@classmethod
Expand All @@ -34,7 +34,7 @@ def slack(cls, message):
)
LOGGER.info('Slack message sent!')
except slack.errors.SlackApiError as slack_error:
LOGGER.warning(f'Could not send Slack message: {slack_error}')
LOGGER.error(f'Could not send Slack message: {slack_error}')
raise slack.errors.SlackApiError(
slack_error.response["ok"], slack_error.response['error']
)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setuptools.setup(
name='pullbug',
version='2.0.2',
version='2.0.3',
description='Get bugged via Slack or RocketChat to merge your GitHub pull requests or GitLab merge requests.', # noqa
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
6 changes: 3 additions & 3 deletions test/unit/test_github_bug.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def test_get_repos_success(mock_request, mock_logger, mock_headers, _mock_user,
def test_get_repos_exception(mock_request, mock_logger, _mock_user, _mock_github_context):
with pytest.raises(requests.exceptions.RequestException):
GithubBug.get_repos(_mock_user, _mock_github_context)
mock_logger.warning.assert_called_once_with(
mock_logger.error.assert_called_once_with(
'Could not retrieve GitHub repos: mock-error'
)

Expand All @@ -144,7 +144,7 @@ def test_get_pull_requests_request_exception(mock_request, mock_logger, _mock_re
mock_repos = [_mock_repo]
with pytest.raises(requests.exceptions.RequestException):
GithubBug.get_pull_requests(mock_repos, _mock_user, _mock_github_state)
mock_logger.warning.assert_called_once_with(
mock_logger.error.assert_called_once_with(
f'Could not retrieve GitHub pull requests for {_mock_repo["name"]}: mock-error'
)

Expand All @@ -155,7 +155,7 @@ def test_get_pull_requests_type_error_exception(mock_request, mock_logger, _mock
mock_repos = [_mock_repo]
with pytest.raises(TypeError):
GithubBug.get_pull_requests(mock_repos, _mock_user, _mock_github_state)
mock_logger.warning.assert_called_once_with(
mock_logger.error.assert_called_once_with(
f'Could not retrieve GitHub pull requests due to bad parameter: {_mock_user} | {_mock_github_state}.'
)

Expand Down
2 changes: 1 addition & 1 deletion test/unit/test_gitlab_bug.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_get_merge_requests_success(mock_request, mock_logger, mock_headers):
def test_get_repos_exception(mock_request, mock_logger):
with pytest.raises(requests.exceptions.RequestException):
GitlabBug.get_merge_requests(_mock_gitlab_scope, _mock_gitlab_state)
mock_logger.warning.assert_called_once_with(
mock_logger.error.assert_called_once_with(
'Could not retrieve GitLab merge requests: mock-error'
)

Expand Down
4 changes: 2 additions & 2 deletions test/unit/test_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_rocket_chat_exception(mock_request, mock_logger):
message = 'mock message'
with pytest.raises(requests.exceptions.RequestException):
Messages.rocketchat(message)
mock_logger.warning.assert_called_once_with(
mock_logger.error.assert_called_once_with(
'Could not send Rocket Chat message: mock-error'
)

Expand All @@ -49,6 +49,6 @@ def test_slack_exception(mock_slack, mock_logger):
message = 'mock message'
with pytest.raises(slack.errors.SlackApiError):
Messages.slack(message)
mock_logger.warning.assert_called_once_with(
mock_logger.error.assert_called_once_with(
"Could not send Slack message: The request to the Slack API failed.\nThe server responded with: {'ok': False, 'error': 'not_authed'}" # noqa
)

0 comments on commit a940a37

Please sign in to comment.