Skip to content

Commit 7b4f258

Browse files
safwanrahmanhonzakral
authored andcommitted
fixing more tests
1 parent d9c30a3 commit 7b4f258

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

test_elasticsearch_dsl/test_document.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ class MyDoc(document.Document):
1818
created_at = field.Date()
1919
inner = field.Object(MyInner)
2020

21+
class Index:
22+
name = 'my-doc'
23+
2124
class MySubDoc(MyDoc):
2225
name = field.Keyword()
2326

@@ -118,6 +121,10 @@ class D(document.Document):
118121
kw = field.Keyword()
119122
class Meta:
120123
doc_type = 'not-doc'
124+
125+
class Index:
126+
name = 'test-not-doc-index'
127+
121128
assert D._index._get_doc_type() == 'not-doc'
122129
assert D._index.to_dict() == {
123130
'mappings': {'not-doc': {'properties': {'kw': {'type': 'keyword'}}}}
@@ -126,7 +133,8 @@ class Meta:
126133
def test_document_cannot_specify_different_doc_type_if_index_defined():
127134
# this will initiate ._index with doc_type = 'doc'
128135
class C(document.Document):
129-
pass
136+
class Index:
137+
name = 'test-doc-type-c'
130138

131139
with raises(IllegalOperation):
132140
class D(C):
@@ -619,7 +627,8 @@ def test_from_es_respects_underscored_non_meta_fields():
619627
}
620628

621629
class Company(document.Document):
622-
pass
630+
class Index:
631+
name = 'test-company'
623632

624633
c = Company.from_es(doc)
625634

test_elasticsearch_dsl/test_integration/test_faceted_search.py

+7
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,17 @@ class Repos(Document):
2121
is_public = Boolean()
2222
created_at = Date()
2323

24+
class Index:
25+
name = 'git'
26+
27+
2428
class Commit(Document):
2529
files = Keyword()
2630
committed_date = Date()
2731

32+
class Index:
33+
name = 'git'
34+
2835
class RepoSearch(FacetedSearch):
2936
index = 'git'
3037
doc_types = [Repos]

test_elasticsearch_dsl/test_result.py

+4
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ def test_bucket_response_can_be_iterated_over(agg_response):
151151
def test_bucket_keys_get_deserialized(aggs_data, aggs_search):
152152
class Commit(Document):
153153
info = Object(properties={'committed_date': Date()})
154+
155+
class Index:
156+
name = 'test-commit'
157+
154158
aggs_search = aggs_search.doc_type(Commit)
155159
agg_response = response.Response(aggs_search, aggs_data)
156160

0 commit comments

Comments
 (0)