Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slacktools-slackfixtures-1.0.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slacktools_slackfixtures-1.0.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file slacktools-slackfixtures-1.0.0.tar.gz.

File metadata

  • Download URL: slacktools-slackfixtures-1.0.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for slacktools-slackfixtures-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a306fafc360f42385382725027d37df7a0951fadb79c09eba87cdbd225dba977
MD5 8a14883faac5b6fa46388b249edf1137
BLAKE2b-256 df0746f6f801267dfb166b267eb7a045ec6631f8a592135d035e62fa53e1bd10

See more details on using hashes here.

File details

Details for the file slacktools_slackfixtures-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: slacktools_slackfixtures-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for slacktools_slackfixtures-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1eb081bea4ecafb59d92bc932a8478aa0bef18e36a3e6bda84485f03bfb8b7cb
MD5 ed0c0e8b221eb34cf4f9ea97e27ad748
BLAKE2b-256 ae92ccfa4e52020c422fa7ab4a26b0a8d0593b1ced0c5618af499507e5e8bfdd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page