diff --git a/Makefile b/Makefile index b2c20af3..3e8cf49f 100644 --- a/Makefile +++ b/Makefile @@ -84,10 +84,19 @@ 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 \ + py.test -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 diff --git a/rhodecode/tests/integrations/test_slack.py b/rhodecode/tests/integrations/test_slack.py index 42daedc6..7e2babee 100644 --- a/rhodecode/tests/integrations/test_slack.py +++ b/rhodecode/tests/integrations/test_slack.py @@ -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):