Skip to main content

swiftmock: A mock backend for testing swift.

🐉 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_container("fake-container")
    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
    mock_swift.put_container("fake-container")
    with pytest.assert_raises(swiftclient.exceptions.ClientException):
        mock_swift.get_object("fake-container", "non/existent/object")

Metadata

Release files for swiftmock 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for swiftmock 0.0.1
File Size Uploaded Provenance Actions
swiftmock-0.0.1.tar.gz 22.6 kB Without provenance Details for swiftmock-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for swiftmock 0.0.1
File Interpreter ABI Platform Actions
swiftmock-0.0.1-py2.py3-none-any.whl Python 2, Python 3 none any Details for swiftmock-0.0.1-py2.py3-none-any.whl

Total release size: 39.9 kB

Release files / swiftmock-0.0.1.tar.gz

Download URL swiftmock-0.0.1.tar.gz
Size 22.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c50317b32f944297704add59a0d62c568e237f5dfd2011721780fbb129b5c980
BLAKE2b-256 checksum
How to use checksums
5a80dc6653a9870944de13aa5d794edc8cad10db81e9800e3fd4b3f486dab543
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

Release files / swiftmock-0.0.1-py2.py3-none-any.whl

Download URL swiftmock-0.0.1-py2.py3-none-any.whl
Size 17.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e7437702b0ef7917fe4ec3e8afca787aee47c45dd989ed61bf9dfa7db4b60d06
BLAKE2b-256 checksum
How to use checksums
fdf0a8bee767a18511a6eebba25b0d849685cab451fea2a76ff5b75107c536cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

Security for swiftmock 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page