No project description provided
Project description
slacktools-slackfixtures
A pytest plugin that adds useful fixtures for testing Slack integrations.
Install:
pip install slacktools-slackfixtures
Example usage:
from myapp.tasks import post_message
def test_post_message(mock_slack):
response_data = {"status": "OK"}
slack = mock_slack(path="myapp.tasks.slack", method="chat_postMessage", response_data=response_data)
response = post_message()
slack.chat_postMessage.assert_called_once()
assert response.data == response_data
Test for failure:
import pytest
from slack.errors import SlackApiError
from myapp.tasks import post_message
def test_post_message_failure(mock_slack):
response_data = {"status": "Not OK"}
slack = mock_slack(
path="myapp.tasks.slack",
method="chat_postMessage",
response_data=response_data,
validates=False
)
response = post_message()
with pytest.raises(SlackApiError):
response.validate()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for slacktools-slackfixtures-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a306fafc360f42385382725027d37df7a0951fadb79c09eba87cdbd225dba977 |
|
MD5 | 8a14883faac5b6fa46388b249edf1137 |
|
BLAKE2b-256 | df0746f6f801267dfb166b267eb7a045ec6631f8a592135d035e62fa53e1bd10 |
Close
Hashes for slacktools_slackfixtures-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1eb081bea4ecafb59d92bc932a8478aa0bef18e36a3e6bda84485f03bfb8b7cb |
|
MD5 | ed0c0e8b221eb34cf4f9ea97e27ad748 |
|
BLAKE2b-256 | ae92ccfa4e52020c422fa7ab4a26b0a8d0593b1ced0c5618af499507e5e8bfdd |