Airtable Mock
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-*
Metadata
Release files for airtablemock 0.0.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| airtablemock-0.0.11.tar.gz | 9.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| airtablemock-0.0.11-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 16.2 kB
Release files / airtablemock-0.0.11.tar.gz
| Download URL | airtablemock-0.0.11.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
caaac9a6e7beae07291de1d551087d0ffaec0dfebafa940d80303d88bb217060
|
|
BLAKE2b-256 checksum How to use checksums |
b220831b0f9b7160fa97078aaeeed625a13bd0d8c9e6fb325272366126118788
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / airtablemock-0.0.11-py2.py3-none-any.whl
| Download URL | airtablemock-0.0.11-py2.py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
ce872409710f429a3f964bb57fdc3797c257e2f2fba84176db91f5fb0634c93a
|
|
BLAKE2b-256 checksum How to use checksums |
87ccd8f8359861e2d2886f9e3d43ba147ff6ef819f5cded258deea98e7c4588b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|