Skip to content

Commit f24ba3a

Browse files
committed
Fixing tests
1 parent 61ae619 commit f24ba3a

File tree

1 file changed

+18
-26
lines changed

1 file changed

+18
-26
lines changed

tests/test_fields.py

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
from six import string_types
77

88
from django_elasticsearch_dsl.exceptions import VariableLookupError
9-
from django_elasticsearch_dsl.fields import (
10-
AttachmentField, BooleanField, ByteField, CompletionField, DEDField,
11-
DateField, DoubleField, FileField, FloatField, GeoPointField,
12-
GeoShapeField, IntegerField, IpField, KeywordField, ListField, LongField,
13-
NestedField, ObjectField, ShortField, StringField, TextField
14-
)
9+
from django_elasticsearch_dsl.fields import (BooleanField, ByteField, CompletionField, DEDField,
10+
DateField, DoubleField, FileField, FloatField,
11+
GeoPointField,
12+
GeoShapeField, IntegerField, IpField, KeywordField,
13+
ListField, LongField,
14+
NestedField, ObjectField, ShortField, TextField
15+
)
1516
from tests import ES_MAJOR_VERSION
1617

1718

@@ -87,8 +88,8 @@ def test_get_mapping(self):
8788

8889
def test_get_value_from_instance(self):
8990
field = ObjectField(attr='person', properties={
90-
'first_name': StringField(analyzier='foo'),
91-
'last_name': StringField()
91+
'first_name': TextField(analyzier='foo'),
92+
'last_name': TextField()
9293
})
9394

9495
instance = NonCallableMock(person=NonCallableMock(
@@ -101,8 +102,8 @@ def test_get_value_from_instance(self):
101102

102103
def test_get_value_from_instance_with_inner_objectfield(self):
103104
field = ObjectField(attr='person', properties={
104-
'first_name': StringField(analyzier='foo'),
105-
'last_name': StringField(),
105+
'first_name': TextField(analyzier='foo'),
106+
'last_name': TextField(),
106107
'aditional': ObjectField(properties={
107108
'age': IntegerField()
108109
})
@@ -121,8 +122,8 @@ def test_get_value_from_instance_with_inner_objectfield(self):
121122

122123
def test_get_value_from_instance_with_none_inner_objectfield(self):
123124
field = ObjectField(attr='person', properties={
124-
'first_name': StringField(analyzier='foo'),
125-
'last_name': StringField(),
125+
'first_name': TextField(analyzier='foo'),
126+
'last_name': TextField(),
126127
'aditional': ObjectField(properties={
127128
'age': IntegerField()
128129
})
@@ -141,8 +142,8 @@ def test_get_value_from_instance_with_none_inner_objectfield(self):
141142

142143
def test_get_value_from_iterable(self):
143144
field = ObjectField(attr='person', properties={
144-
'first_name': StringField(analyzier='foo'),
145-
'last_name': StringField()
145+
'first_name': TextField(analyzier='foo'),
146+
'last_name': TextField()
146147
})
147148

148149
instance = NonCallableMock(
@@ -204,9 +205,9 @@ def test_get_mapping(self):
204205
}, field.to_dict())
205206

206207

207-
class StringFieldTestCase(TestCase):
208+
class TextFieldTestCase(TestCase):
208209
def test_get_mapping(self):
209-
field = StringField()
210+
field = TextField()
210211

211212
expected_type = 'string' if ES_MAJOR_VERSION == 2 else 'text'
212213

@@ -298,20 +299,11 @@ def test_get_value_from_instance(self):
298299
instance = NonCallableMock(
299300
foo=NonCallableMock(bar=["alpha", "beta", "gamma"])
300301
)
301-
field = ListField(StringField(attr='foo.bar'))
302+
field = ListField(TextField(attr='foo.bar'))
302303
self.assertEqual(
303304
field.get_value_from_instance(instance), instance.foo.bar)
304305

305306

306-
class AttachmentFieldTestCase(TestCase):
307-
def test_get_mapping(self):
308-
field = AttachmentField()
309-
310-
self.assertEqual({
311-
'type': 'attachment',
312-
}, field.to_dict())
313-
314-
315307
class ShortFieldTestCase(TestCase):
316308
def test_get_mapping(self):
317309
field = ShortField()

0 commit comments

Comments
 (0)