We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 62363f3 commit 3045e4eCopy full SHA for 3045e4e
tests/test_index.py
@@ -112,6 +112,22 @@ class ExampleIndex(AlgoliaIndex):
112
self.assertNotIn('category', obj)
113
self.assertEqual(len(obj), 3)
114
115
+ def test_fields_with_custom_name(self):
116
+ class ExampleIndex(AlgoliaIndex):
117
+ fields = {
118
+ 'name': 'shopName',
119
+ 'address': 'shopAddress'
120
+ }
121
+
122
+ index = ExampleIndex(Example, self.client)
123
+ obj = index._build_object(self.instance)
124
+ self.assertDictContainsSubset({
125
+ 'shopName': self.instance.name,
126
+ 'shopAddress': self.instance.address
127
+ }, obj)
128
+ self.assertNotIn('name', obj)
129
+ self.assertNotIn('address', obj)
130
131
def test_invalid_fields(self):
132
class ExampleIndex(AlgoliaIndex):
133
fields = ('name', 'color')
0 commit comments