Merge pull request !2734 from rhodecode-enterprise-ce slack-tests-fix
Changes from branch: Slack tests fix
This commit is contained in:
commit
24a8bbce1e
3 changed files with 21 additions and 7 deletions
11
Makefile
11
Makefile
|
|
@ -84,13 +84,22 @@ test-only:
|
|||
rhodecode/tests/database
|
||||
|
||||
.PHONY: test-simple
|
||||
# test-simple: Run tests only for main test suite witout coverage
|
||||
# test-simple: Run tests only for main test suite without coverage
|
||||
test-simple:
|
||||
PYTHONHASHSEED=random \
|
||||
py.test -x -vv -r xw -p no:sugar \
|
||||
--ignore=rhodecode/tests/vcs_operations \
|
||||
--ignore=rhodecode/tests/database
|
||||
|
||||
|
||||
.PHONY: test-custom
|
||||
# test-custom: Run tests without coverage, only run tests matching PATTERN
|
||||
test-custom:
|
||||
PYTHONHASHSEED=random \
|
||||
py.test $(if $(PATTERN),-k "$(PATTERN)",) -vv -r xw -p no:sugar \
|
||||
--ignore=rhodecode/tests/vcs_operations \
|
||||
--ignore=rhodecode/tests/database
|
||||
|
||||
# >>> Docs commands
|
||||
|
||||
.PHONY: docs
|
||||
|
|
|
|||
|
|
@ -156,13 +156,14 @@ class TestGetRepoChangeset(object):
|
|||
expected = "commit_id must be a string value got <class 'int'> instead"
|
||||
assert_error(id_, expected, given=response.body)
|
||||
|
||||
@pytest.mark.skip(reason="This test is currently broken")
|
||||
@pytest.mark.parametrize("details", ["basic", "extended", "full"])
|
||||
def test_get_repo_changeset_empty_revs(self, details, backend_svn):
|
||||
"""
|
||||
Test case for repositories with empty revisions.
|
||||
Ensures that no crashes occur and an empty list is returned.
|
||||
"""
|
||||
empty_rev_id = "1000"
|
||||
empty_rev_id = "1000"
|
||||
|
||||
__, params = build_data(
|
||||
self.apikey,
|
||||
|
|
@ -172,9 +173,9 @@ class TestGetRepoChangeset(object):
|
|||
limit=10,
|
||||
details=details,
|
||||
)
|
||||
|
||||
|
||||
response = api_call(self.app, params)
|
||||
result = response.json["result"]
|
||||
|
||||
assert isinstance(result, list)
|
||||
assert isinstance(result, list)
|
||||
assert len(result) == 0
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import mock
|
|||
from mock import patch
|
||||
|
||||
from rhodecode import events
|
||||
from rhodecode.integrations.types.handlers.slack import SlackDataHandler
|
||||
from rhodecode.integrations.types.handlers.slack import SlackDataHandler, SlackData
|
||||
from rhodecode.model.db import Session, Integration
|
||||
from rhodecode.integrations.types.slack import SlackIntegrationType
|
||||
from rhodecode.tests import GIT_REPO
|
||||
|
|
@ -100,10 +100,14 @@ def slack_integration_empty(request, app, slack_settings):
|
|||
def test_slack_push(slack_integration, repo_push_event):
|
||||
with patch("rhodecode.integrations.types.slack.post_text_to_slack") as call:
|
||||
events.trigger(repo_push_event)
|
||||
# make sure we can handle both dicts and dataclass objects
|
||||
slack_data = call.call_args[0][1]
|
||||
if isinstance(slack_data, dict):
|
||||
slack_data = SlackData(**slack_data)
|
||||
|
||||
assert "pushed to" in call.call_args[0][1].title
|
||||
assert "pushed to" in slack_data.title
|
||||
# specific commit was parsed and serialized
|
||||
assert "change that fixes #41" in call.call_args[0][1].text
|
||||
assert "change that fixes #41" in slack_data.text
|
||||
|
||||
|
||||
def test_slack_push_no_events(slack_integration_empty, repo_push_event):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue