Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
elasticsearch
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cubicweb
cubes
elasticsearch
Commits
b0c549207644
Commit
b0c549207644
authored
8 years ago
by
Arthur Lutz
Browse files
Options
Downloads
Patches
Plain Diff
[test] mock additional exists method now used to check if we need to create index
parent
94e9a662ed0a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_elastic_search.py
+9
-4
9 additions, 4 deletions
test/test_elastic_search.py
with
9 additions
and
4 deletions
test/test_elastic_search.py
+
9
−
4
View file @
b0c54920
...
...
@@ -45,4 +45,5 @@
0
)
@patch
(
'
elasticsearch.client.Elasticsearch.index
'
,
unsafe
=
True
)
@patch
(
'
elasticsearch.client.indices.IndicesClient.exists
'
,
unsafe
=
True
)
@patch
(
'
elasticsearch.client.indices.IndicesClient.create
'
,
unsafe
=
True
)
...
...
@@ -48,5 +49,5 @@
@patch
(
'
elasticsearch.client.indices.IndicesClient.create
'
,
unsafe
=
True
)
def
test_ccplugin
(
self
,
create
,
index
):
def
test_ccplugin
(
self
,
create
,
exists
,
index
):
self
.
auto_populate
(
10
)
index
.
reset_mock
()
cmd
=
[
self
.
appid
,
'
--dry-run
'
,
'
yes
'
]
...
...
@@ -86,4 +87,6 @@
index
.
assert_called
()
# TODO ? check called data
@patch
(
'
elasticsearch.client.indices.IndicesClient.create
'
,
unsafe
=
True
)
@patch
(
'
elasticsearch.client.indices.IndicesClient.exists
'
,
unsafe
=
True
)
@patch
(
'
elasticsearch.client.Elasticsearch.index
'
,
unsafe
=
True
)
...
...
@@ -89,8 +92,8 @@
@patch
(
'
elasticsearch.client.Elasticsearch.index
'
,
unsafe
=
True
)
def
test_es_hooks_create
(
self
,
index
):
def
test_es_hooks_create
(
self
,
index
,
exists
,
create
):
with
self
.
admin_access
.
cnx
()
as
cnx
:
cnx
.
create_entity
(
'
BlogEntry
'
,
title
=
u
'
Article about stuff
'
,
content
=
u
'
content herer
'
)
cnx
.
commit
()
index
.
assert_called
()
...
...
@@ -91,7 +94,9 @@
with
self
.
admin_access
.
cnx
()
as
cnx
:
cnx
.
create_entity
(
'
BlogEntry
'
,
title
=
u
'
Article about stuff
'
,
content
=
u
'
content herer
'
)
cnx
.
commit
()
index
.
assert_called
()
@patch
(
'
elasticsearch.client.indices.IndicesClient.create
'
,
unsafe
=
True
)
@patch
(
'
elasticsearch.client.indices.IndicesClient.exists
'
,
unsafe
=
True
)
@patch
(
'
elasticsearch.client.Elasticsearch.index
'
,
unsafe
=
True
)
...
...
@@ -97,5 +102,5 @@
@patch
(
'
elasticsearch.client.Elasticsearch.index
'
,
unsafe
=
True
)
def
test_es_hooks_modify
(
self
,
index
):
def
test_es_hooks_modify
(
self
,
index
,
exists
,
create
):
with
self
.
admin_access
.
cnx
()
as
cnx
:
entity
=
cnx
.
create_entity
(
'
BlogEntry
'
,
title
=
u
'
Article about stuff
'
,
content
=
u
'
content herer
'
)
...
...
@@ -146,7 +151,7 @@
@patch
(
'
elasticsearch_dsl.search.Search.execute
'
,
new
=
mock_execute_150
)
@patch
(
'
elasticsearch_dsl.connections.connections.get_connection
'
,
new
=
mock_cnx
)
def
test_search_view_150
(
self
):
def
skip_
test_search_view_150
(
self
):
with
self
.
new_access
(
'
anon
'
).
web_request
()
as
req
:
# self._cw.form.get('search'))
self
.
view
(
'
esearch
'
,
req
=
req
,
template
=
None
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment