File tree 2 files changed +8
-10
lines changed 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,12 @@ def conn(self):
66
66
self ._connection = self ._connect ()
67
67
return self ._connection
68
68
69
+ def drop_all (self ):
70
+ """Delete the index and its contents"""
71
+ if self .conn .indices .exists (self .index ):
72
+ self .conn .indices .close (self .index )
73
+ self .conn .indices .delete (self .index )
74
+
69
75
def create_models (self , models ):
70
76
mappings = _compile_mappings (models )
71
77
analysis = _compile_analysis (models )
@@ -163,12 +169,6 @@ def get_mapping(cls):
163
169
def get_analysis (cls ):
164
170
return getattr (cls , '__analysis__' , {})
165
171
166
- @classmethod
167
- def drop_all (cls ):
168
- if cls .es .conn .indices .exists (cls .es .index ):
169
- cls .es .conn .indices .close (cls .es .index )
170
- cls .es .conn .indices .delete (cls .es .index )
171
-
172
172
# It would be lovely if this were called 'get', but the dict semantics
173
173
# already define that method name.
174
174
@classmethod
Original file line number Diff line number Diff line change @@ -30,14 +30,12 @@ class TestCase(object):
30
30
@classmethod
31
31
def setup_class (cls ):
32
32
cls .app = create_app ()
33
- annotation .Annotation .drop_all ()
34
- document .Document .drop_all ()
33
+ es .drop_all ()
35
34
36
35
def setup (self ):
37
36
es .create_models ([annotation .Annotation , document .Document ])
38
37
es .conn .cluster .health (wait_for_status = 'yellow' )
39
38
self .cli = self .app .test_client ()
40
39
41
40
def teardown (self ):
42
- annotation .Annotation .drop_all ()
43
- document .Document .drop_all ()
41
+ es .drop_all ()
You can’t perform that action at this time.
0 commit comments