wagtail-nest / wagtail-airtable

Airtable import and export support for Wagtail pages and Django models.
BSD 3-Clause "New" or "Revised" License
49 stars 15 forks source link

Add WAGTAIL_AIRTABLE_TESTING flag to enable the mock API #58

Closed gasman closed 7 months ago

gasman commented 7 months ago

Currently, this line is used to check whether to use the mock Airtable API in place of the real one:

TESTING = any(x in ["test", "runtests.py"] for x in sys.argv)

I spent far too long wondering why my tests were failing locally, because I was invoking them with python ./runtests.py (which doesn't match the above test) instead of python runtests.py.

This change makes this more robust, by introducing an explicit WAGTAIL_AIRTABLE_TESTING variable in settings - so the mock will be used any time the tests.settings settings module is active.