Framework integration
/
Django
Nov. 20, 2023
Tests
To run the tests, first find your Algolia application id and Admin API key (found on the Credentials page).
Copy
1
ALGOLIA_APPLICATION_ID={APPLICATION_ID} ALGOLIA_API_KEY={ADMIN_API_KEY} tox
To override settings for some tests, use the settings method:
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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():
# Your test function
pass
Did you find this page helpful?