Skip to main content

A mock backend for testing swift.

Project description

🐉 Installation

Install from PyPI:

$ pip install swiftmock

🐉 Usage

Importing directly

You can use swiftmock directly in your code:

from swiftmock.swift import MockConnection
with MockConnection() as conn:
    conn.put_object("fake-container", "path/to/object", b"contents")
    header, contents = conn.get_object("fake-container", "path/to/object")
assert contents == b"contents"

Using with Pytest

You can also use this library as a pytest plugin.

def my_test_using_swift(mock_swift):
    # optional, the mock automatically replaces *swiftclient.client.Connection*
    # so that it automatically returns the mocked instance
    with pytest.assert_raises(swiftclient.exceptions.ClientException):
        mock_swift.get_object("fake-container", "non/existent/object")

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

swiftmock-0.0.1.tar.gz (22.6 kB view hashes)

Uploaded Source

Built Distribution

swiftmock-0.0.1-py2.py3-none-any.whl (17.3 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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