Skip to content

Commit 76e44fa

Browse files
committed
start testing index
1 parent a9eda03 commit 76e44fa

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/test_index.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from django.test import TestCase
2+
from django.db import models
3+
4+
from django.contrib.algoliasearch import AlgoliaIndex
5+
from django.contrib.algoliasearch import algolia_engine
6+
7+
from .models import Example
8+
9+
10+
class IndexTestCase(TestCase):
11+
def setUp(self):
12+
self.client = algolia_engine.client
13+
14+
def test_default_index_name(self):
15+
index = AlgoliaIndex(Example, self.client)
16+
self.assertEqual(index.index_name, 'django_Example_test')
17+
18+
def test_custom_index_name(self):
19+
class ExampleIndex(AlgoliaIndex):
20+
index_name = 'customName'
21+
22+
index = ExampleIndex(Example, self.client)
23+
self.assertEqual(index.index_name, 'django_customName_test')

0 commit comments

Comments
 (0)