Skip to main content

Mock library for the airtable python client

Project description

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-*

Project details


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)

Uploaded Source

Built Distribution

airtablemock-0.0.11-py2.py3-none-any.whl (6.7 kB view details)

Uploaded Python 2 Python 3

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

Hashes for airtablemock-0.0.11.tar.gz
Algorithm Hash digest
SHA256 caaac9a6e7beae07291de1d551087d0ffaec0dfebafa940d80303d88bb217060
MD5 47a0391643e1d524ea366f0134d670a4
BLAKE2b-256 b220831b0f9b7160fa97078aaeeed625a13bd0d8c9e6fb325272366126118788

See more details on using hashes here.

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

Hashes for airtablemock-0.0.11-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ce872409710f429a3f964bb57fdc3797c257e2f2fba84176db91f5fb0634c93a
MD5 4aabea8ca2978bcd24e41ce529a392ab
BLAKE2b-256 87ccd8f8359861e2d2886f9e3d43ba147ff6ef819f5cded258deea98e7c4588b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page