Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion rorapi/management/commands/indexror.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import pathlib
import shutil
from rorapi.settings import ES7, ES_VARS, DATA
import random

from django.core.management.base import BaseCommand
from elasticsearch import TransportError
Expand Down
13 changes: 13 additions & 0 deletions rorapi/tests/tests_unit/tests_views_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ def setUp(self):
'data/test_data_search_es7_v2.json'), 'r') as f:
self.test_data = json.load(f)

@mock.patch('elasticsearch_dsl.Search.execute')
def test_search_organizations_with_affiliations_match(self, search_mock):
view = views.OrganizationViewSet.as_view({'get': 'list'})
request = factory.get('/v2/organizations?affiliation=Sorbonne University, France&single_search= ')

response = view(request, version=self.V2_VERSION)
response.render()
organizations = json.loads(response.content.decode('utf-8'))

print("testing affiliations match: ", organizations)
self.assertNotEqual(organizations['number_of_results'], 0)


@mock.patch('elasticsearch_dsl.Search.execute')
def test_search_organizations(self, search_mock):
search_mock.return_value = \
Expand Down