Test Framework¶
Extensions for Django’s test framework to add support for Heroku Connect.
The custom database engine will create the Heroku Connect schema for you.
The schema is created right via the
pre_migrate
signal, only when a
test database is created. This will work for both Django’s build in test
suite as well as pytest-django and maybe others.
Utilities¶
Test utilities for Django and Heroku Connect.
- heroku_connect.test.utils.heroku_cli(stdout='', stderr='', exit_code=0)[source]¶
Context manager to mock the Heroku CLI command.
Example:
import subprocess from heroku_connect.test.utils import heroku_cli with heroku_cli(stdout='success', stderr='warning', exit=0): process = subprocess.run( ['heroku'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) assert process.returncode == 0 assert process.stdout == b'success\n' assert process.stderr == b'warning\n'