用于Airtable Python客户端的Mock库
项目描述
一个Mock库,帮助测试使用Python库访问Airtable的Python代码。
它将表存储在RAM中,并能执行基本操作。
安装
最简单的方法是使用pip
pip install airtablemock
使用方法
在您的测试中,修补整个airtable库
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')
…
发布
要创建airtablemock的新版本,对Git仓库进行标记并运行
python setup.py sdist bdist_wheel
twine upload dist/airtablemock-*
项目详情
关闭
airtablemock-0.0.11.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | caaac9a6e7beae07291de1d551087d0ffaec0dfebafa940d80303d88bb217060 |
|
MD5 | 47a0391643e1d524ea366f0134d670a4 |
|
BLAKE2b-256 | b220831b0f9b7160fa97078aaeeed625a13bd0d8c9e6fb325272366126118788 |
关闭
airtablemock-0.0.11-py2.py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | ce872409710f429a3f964bb57fdc3797c257e2f2fba84176db91f5fb0634c93a |
|
MD5 | 4aabea8ca2978bcd24e41ce529a392ab |
|
BLAKE2b-256 | 87ccd8f8359861e2d2886f9e3d43ba147ff6ef819f5cded258deea98e7c4588b |