Integrations / Frameworks / Django / Tests
Jan. 25, 2019

Run Tests

To run the tests, first find your Algolia application id and Admin API key (found on the Credentials page).

1
ALGOLIA_APPLICATION_ID={APPLICATION_ID} ALGOLIA_API_KEY={ADMIN_API_KEY} tox

To override settings for some tests, use the settings method:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
class OverrideSettingsTestCase(TestCase):
    def setUp(self):
        with self.settings(ALGOLIA={
            'APPLICATION_ID': 'foo',
            'API_KEY': 'bar',
            'AUTO_INDEXING': False
        }):
            algolia_engine.reset(settings.ALGOLIA)

    def tearDown(self):
        algolia_engine.reset(settings.ALGOLIA)

    def test_foo():
        # ...

Did you find this page helpful?