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_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")
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
swiftmock-0.0.1.tar.gz
(22.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swiftmock-0.0.1.tar.gz.
File metadata
- Download URL: swiftmock-0.0.1.tar.gz
- Upload date:
- Size: 22.6 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c50317b32f944297704add59a0d62c568e237f5dfd2011721780fbb129b5c980
|
|
| MD5 |
0cb2b4de8e207225717b31c487090eed
|
|
| BLAKE2b-256 |
5a80dc6653a9870944de13aa5d794edc8cad10db81e9800e3fd4b3f486dab543
|
File details
Details for the file swiftmock-0.0.1-py2.py3-none-any.whl.
File metadata
- Download URL: swiftmock-0.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 2, Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7437702b0ef7917fe4ec3e8afca787aee47c45dd989ed61bf9dfa7db4b60d06
|
|
| MD5 |
aaea15c4f053e5dd1c0d88760060601e
|
|
| BLAKE2b-256 |
fdf0a8bee767a18511a6eebba25b0d849685cab451fea2a76ff5b75107c536cd
|