File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99import pathlib
1010import shutil
1111from rorapi .settings import ES7 , ES_VARS , DATA
12- import random
1312
1413from django .core .management .base import BaseCommand
1514from elasticsearch import TransportError
Original file line number Diff line number Diff line change @@ -22,6 +22,19 @@ def setUp(self):
2222 'data/test_data_search_es7_v2.json' ), 'r' ) as f :
2323 self .test_data = json .load (f )
2424
25+ @mock .patch ('elasticsearch_dsl.Search.execute' )
26+ def test_search_organizations_with_affiliations_match (self , search_mock ):
27+ view = views .OrganizationViewSet .as_view ({'get' : 'list' })
28+ request = factory .get ('/v2/organizations?affiliation=Sorbonne University, France&single_search= ' )
29+
30+ response = view (request , version = self .V2_VERSION )
31+ response .render ()
32+ organizations = json .loads (response .content .decode ('utf-8' ))
33+
34+ print ("testing affiliations match: " , organizations )
35+ self .assertNotEqual (organizations ['number_of_results' ], 0 )
36+
37+
2538 @mock .patch ('elasticsearch_dsl.Search.execute' )
2639 def test_search_organizations (self , search_mock ):
2740 search_mock .return_value = \
You can’t perform that action at this time.
0 commit comments