File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 66from faker import Faker
77
88
9+ def check_credentials ():
10+ credentials = [
11+ 'ALGOLIA_APPLICATION_ID' ,
12+ 'ALGOLIA_API_KEY' ,
13+ 'ALGOLIA_API_KEY_SEARCH' ,
14+ 'ALGOLIA_APPLICATION_ID_MCM' ,
15+ 'ALGOLIA_API_KEY_MCM'
16+ ]
17+
18+ for credential in credentials :
19+ if credential not in os .environ :
20+ print ('environement variable {} not defined' )
21+ assert False
22+
23+
924def index_name ():
1025 name = 'algolia-python{}' .format (randint (1 , 100000 ))
1126
@@ -64,6 +79,7 @@ def create_client(
6479 'urlfetch' , urlfetch_stub .URLFetchServiceStub ()
6580 )
6681
82+ check_credentials ()
6783 try :
6884 return algoliasearch .Client (
6985 os .environ [app_id_env ],
Original file line number Diff line number Diff line change 44from algoliasearch .client import RequestOptions , MAX_API_KEY_LENGTH , Client
55from algoliasearch .helpers import AlgoliaException
66from fake_session import FakeSession
7- from helpers import Factory
7+ from helpers import Factory , check_credentials
88
99
1010def test_request_options (client ):
@@ -105,6 +105,7 @@ def user_name(self):
105105
106106
107107def test_dns_timeout ():
108+ check_credentials ()
108109 app_id = os .environ ['ALGOLIA_APPLICATION_ID' ]
109110
110111 hosts = ['algolia.biz' ]
@@ -124,6 +125,7 @@ def test_dns_timeout():
124125
125126
126127def test_dns_timeout_hard ():
128+ check_credentials ()
127129 app_id = os .environ ['ALGOLIA_APPLICATION_ID' ]
128130
129131 hosts = ['algolia.biz' , '%s-dsn.algolia.net' % app_id ]
Original file line number Diff line number Diff line change @@ -388,7 +388,7 @@ def test_search(ro_index):
388388
389389 res = ro_index .search ('' , {'analytics' : False })
390390 assert res ['nbHits' ] == 5
391- assert re .match (r'analytics=false' , res ['params' ])
391+ assert re .search (r'analytics=false' , res ['params' ])
392392
393393 res = ro_index .search (ro_index .data [2 ]['name' ][0 ])
394394 assert res ['nbHits' ] >= 1
You can’t perform that action at this time.
0 commit comments