A mock library to help test Python code accessing Airtable using the Python library.
It keeps tables in RAM and can do basic operations.
Installation
The easiest way is using pip:
pip install airtablemock
Usage
In your test, you patch the whole airtable library:
import unittest
import airtablemock
import mycode
@airtablemock.patch(mycode.__name__ + '.airtable')
class TestMyCode(unittest.TestCase):
def test_foo():
# This is a client for the base "baseID", it will not access the real
# Airtable service but only the mock one which keeps data in RAM.
client = airtablemock.Airtable('baseID', 'apiKey')
# Populate the table.
client.create('table-foo', {'field1': 1, 'field2': 'two'})
# Run your code that uses Airtable, it should transparently uses the table
# above.
mycode.run()
# Access the table again to check if anything was modified.
records = client.get('table-foo')
…
Release
To create a new release of airtablemock, tag the Git repo and run:
python setup.py sdist bdist_wheel
twine upload dist/airtablemock-*
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
airtablemock-0.0.11.tar.gz
(9.5 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 airtablemock-0.0.11.tar.gz.
File metadata
- Download URL: airtablemock-0.0.11.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
caaac9a6e7beae07291de1d551087d0ffaec0dfebafa940d80303d88bb217060
|
|
| MD5 |
47a0391643e1d524ea366f0134d670a4
|
|
| BLAKE2b-256 |
b220831b0f9b7160fa97078aaeeed625a13bd0d8c9e6fb325272366126118788
|
File details
Details for the file airtablemock-0.0.11-py2.py3-none-any.whl.
File metadata
- Download URL: airtablemock-0.0.11-py2.py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce872409710f429a3f964bb57fdc3797c257e2f2fba84176db91f5fb0634c93a
|
|
| MD5 |
4aabea8ca2978bcd24e41ce529a392ab
|
|
| BLAKE2b-256 |
87ccd8f8359861e2d2886f9e3d43ba147ff6ef819f5cded258deea98e7c4588b
|