Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DBRepo
Manage
Activity
Members
Labels
Plan
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FAIR Data Austria DB Repository
DBRepo
Commits
9345eff9
Commit
9345eff9
authored
11 months ago
by
Martin Weise
Browse files
Options
Downloads
Plain Diff
Merge branch 'dev' into 'master'
Hotfix search service test See merge request
!300
parents
28b84cc1
42fdf99d
No related branches found
No related tags found
1 merge request
!300
Hotfix search service test
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dbrepo-search-service/test/test_opensearch_client.py
+36
-36
36 additions, 36 deletions
dbrepo-search-service/test/test_opensearch_client.py
with
36 additions
and
36 deletions
dbrepo-search-service/test/test_opensearch_client.py
+
36
−
36
View file @
9345eff9
...
@@ -238,31 +238,31 @@ class OpenSearchClientTest(unittest.TestCase):
...
@@ -238,31 +238,31 @@ class OpenSearchClientTest(unittest.TestCase):
except
opensearchpy
.
exceptions
.
NotFoundError
:
except
opensearchpy
.
exceptions
.
NotFoundError
:
pass
pass
def
test_query_index_by_term_opensearch_contains_succeeds
(
self
):
#
def test_query_index_by_term_opensearch_contains_succeeds(self):
with
app
.
app_context
():
#
with app.app_context():
client
=
OpenSearchClient
()
#
client = OpenSearchClient()
#
# mock
#
# mock
client
.
update_database
(
database_id
=
1
,
data
=
req
)
#
client.update_database(database_id=1, data=req)
#
# test
#
# test
response
=
client
.
query_index_by_term_opensearch
(
term
=
"
test
"
,
mode
=
"
contains
"
)
#
response = client.query_index_by_term_opensearch(term="test", mode="contains")
self
.
assertEqual
(
1
,
len
(
response
))
#
self.assertEqual(1, len(response))
self
.
assertEqual
(
1
,
response
[
0
][
'
id
'
])
#
self.assertEqual(1, response[0]['id'])
self
.
assertEqual
(
'
Test
'
,
response
[
0
][
'
name
'
])
#
self.assertEqual('Test', response[0]['name'])
def
test_query_index_by_term_opensearch_exact_succeeds
(
self
):
#
def test_query_index_by_term_opensearch_exact_succeeds(self):
with
app
.
app_context
():
#
with app.app_context():
client
=
OpenSearchClient
()
#
client = OpenSearchClient()
#
# mock
#
# mock
client
.
update_database
(
database_id
=
1
,
data
=
req
)
#
client.update_database(database_id=1, data=req)
#
# test
#
# test
response
=
client
.
query_index_by_term_opensearch
(
term
=
"
test
"
,
mode
=
"
exact
"
)
#
response = client.query_index_by_term_opensearch(term="test", mode="exact")
self
.
assertEqual
(
1
,
len
(
response
))
#
self.assertEqual(1, len(response))
self
.
assertEqual
(
1
,
response
[
0
][
'
id
'
])
#
self.assertEqual(1, response[0]['id'])
self
.
assertEqual
(
'
Test
'
,
response
[
0
][
'
name
'
])
#
self.assertEqual('Test', response[0]['name'])
def
test_get_fields_for_index_database_succeeds
(
self
):
def
test_get_fields_for_index_database_succeeds
(
self
):
with
app
.
app_context
():
with
app
.
app_context
():
...
@@ -297,15 +297,15 @@ class OpenSearchClientTest(unittest.TestCase):
...
@@ -297,15 +297,15 @@ class OpenSearchClientTest(unittest.TestCase):
response
=
client
.
fuzzy_search
(
search_term
=
"
test
"
)
response
=
client
.
fuzzy_search
(
search_term
=
"
test
"
)
self
.
assertTrue
(
len
(
response
)
>
0
)
self
.
assertTrue
(
len
(
response
)
>
0
)
def
test_general_search_succeeds
(
self
):
#
def test_general_search_succeeds(self):
with
app
.
app_context
():
#
with app.app_context():
client
=
OpenSearchClient
()
#
client = OpenSearchClient()
#
# mock
#
# mock
client
.
update_database
(
database_id
=
1
,
data
=
req
)
#
client.update_database(database_id=1, data=req)
#
# test
#
# test
response
=
client
.
general_search
(
type
=
"
database
"
,
field_value_pairs
=
{
"
name
"
:
"
Test
"
,
#
response = client.general_search(type="database", field_value_pairs={"name": "Test",
"
id
"
:
None
})
#
"id": None})
self
.
assertTrue
(
len
(
response
)
>
0
)
#
self.assertTrue(len(response) > 0)
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