コード例 #1
0
 def test_deconstruction(self):
     index = ZomboDBIndex(
         fields=['title'],
         name='test_title_zombodb',
         url='http://localhost/',
         shards=2,
         replicas=2,
         alias='test-alias',
         refresh_interval='10s',
         type_name='test-doc',
         bulk_concurrency=20,
         batch_size=8388608 * 2,
         compression_level=9,
         llapi=True,
     )
     path, args, kwargs = index.deconstruct()
     self.assertEqual(path, 'django_zombodb.indexes.ZomboDBIndex')
     self.assertEqual(args, ())
     self.assertEqual(
         kwargs, {
             'fields': ['title'],
             'name': 'test_title_zombodb',
             'url': 'http://localhost/',
             'shards': 2,
             'replicas': 2,
             'alias': 'test-alias',
             'refresh_interval': '10s',
             'type_name': 'test-doc',
             'bulk_concurrency': 20,
             'batch_size': 8388608 * 2,
             'compression_level': 9,
             'llapi': True,
         })
コード例 #2
0
 def test_deconstruct_no_args(self):
     index = ZomboDBIndex(fields=['title'], name='test_title_zombodb')
     path, args, kwargs = index.deconstruct()
     self.assertEqual(path, 'django_zombodb.indexes.ZomboDBIndex')
     self.assertEqual(args, ())
     self.assertEqual(kwargs, {
         'fields': ['title'],
         'name': 'test_title_zombodb'
     })