🐉 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")
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)
| File | Size | Uploaded | |
|---|---|---|---|
| swiftmock-0.0.1.tar.gz | 22.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| swiftmock-0.0.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
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
|