Skip to content

Commit b61ca64

Browse files
author
Francesco Faraone
authored
Merge pull request #45 from cloudblue/LITE-24137
LITE-24137: changed the ConnectClient default for use_specs to false
2 parents 1fc33b9 + 6be7d07 commit b61ca64

File tree

3 files changed

+43
-59
lines changed

3 files changed

+43
-59
lines changed

connect/client/fluent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def __init__(
2323
self,
2424
api_key,
2525
endpoint=None,
26-
use_specs=True,
26+
use_specs=False,
2727
specs_location=None,
2828
validate_using_specs=True,
2929
default_headers=None,

tests/async_client/test_fluent.py

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ async def test_async_get(async_mocker):
1313
kwargs = {
1414
'arg1': 'val1',
1515
}
16-
c = AsyncConnectClient('API_KEY', use_specs=False)
16+
c = AsyncConnectClient('API_KEY')
1717
mocked = async_mocker.AsyncMock()
1818
c.execute = mocked
1919
await c.get(url, **kwargs)
@@ -30,7 +30,7 @@ async def test_create(async_mocker, attr):
3030
}
3131
kwargs[attr] = {'k1': 'v1'}
3232

33-
c = AsyncConnectClient('API_KEY', use_specs=False)
33+
c = AsyncConnectClient('API_KEY')
3434
c.execute = mocked
3535

3636
await c.create(url, **kwargs)
@@ -53,7 +53,7 @@ async def test_update(async_mocker, attr):
5353
}
5454
kwargs[attr] = {'k1': 'v1'}
5555

56-
c = AsyncConnectClient('API_KEY', use_specs=False)
56+
c = AsyncConnectClient('API_KEY')
5757
c.execute = mocked
5858

5959
await c.update(url, **kwargs)
@@ -71,7 +71,7 @@ async def test_delete_no_args(async_mocker):
7171
mocked = async_mocker.AsyncMock()
7272
url = 'https://localhost'
7373

74-
c = AsyncConnectClient('API_KEY', use_specs=False)
74+
c = AsyncConnectClient('API_KEY')
7575
c.execute = mocked
7676

7777
await c.delete(url)
@@ -90,7 +90,7 @@ async def test_delete(async_mocker, attr):
9090
}
9191
kwargs[attr] = {'k1': 'v1'}
9292

93-
c = AsyncConnectClient('API_KEY', use_specs=False)
93+
c = AsyncConnectClient('API_KEY')
9494
c.execute = mocked
9595

9696
await c.delete(url, **kwargs)
@@ -115,7 +115,6 @@ async def test_execute(httpx_mock):
115115
ios = io.StringIO()
116116
c = AsyncConnectClient('API_KEY',
117117
endpoint='https://localhost',
118-
use_specs=False,
119118
logger=RequestLogger(file=ios))
120119

121120
results = await c.execute('get', 'resources')
@@ -134,7 +133,7 @@ async def test_execute_validate_with_specs(async_mocker):
134133
mocked_specs = async_mocker.MagicMock()
135134
mocked_specs.exists.return_value = False
136135

137-
c = AsyncConnectClient('API_KEY', use_specs=False)
136+
c = AsyncConnectClient('API_KEY')
138137
c.specs = mocked_specs
139138
c._use_specs = True
140139
with pytest.raises(ClientError) as cv:
@@ -154,7 +153,6 @@ async def test_execute_non_json_response(httpx_mock):
154153
c = AsyncConnectClient(
155154
'API_KEY',
156155
endpoint='https://localhost',
157-
use_specs=False,
158156
)
159157
result = await c.execute('get', 'resources')
160158
assert result == b'This is a non json response.'
@@ -185,7 +183,6 @@ async def test_execute_retries(httpx_mock):
185183
c = AsyncConnectClient(
186184
'API_KEY',
187185
endpoint='https://localhost',
188-
use_specs=False,
189186
max_retries=2,
190187
)
191188

@@ -221,7 +218,6 @@ async def test_execute_max_retries_exceeded(httpx_mock):
221218
c = AsyncConnectClient(
222219
'API_KEY',
223220
endpoint='https://localhost',
224-
use_specs=False,
225221
max_retries=2,
226222
)
227223

@@ -240,7 +236,6 @@ async def test_execute_default_headers(httpx_mock):
240236
c = AsyncConnectClient(
241237
'API_KEY',
242238
endpoint='https://localhost',
243-
use_specs=False,
244239
default_headers={'X-Custom-Header': 'custom-header-value'},
245240
)
246241

@@ -262,7 +257,7 @@ async def test_execute_with_kwargs(httpx_mock):
262257
status_code=201,
263258
)
264259

265-
c = AsyncConnectClient('API_KEY', endpoint='https://localhost', use_specs=False)
260+
c = AsyncConnectClient('API_KEY', endpoint='https://localhost')
266261
kwargs = {
267262
'headers': {
268263
'X-Custom-Header': 'value',
@@ -294,7 +289,7 @@ async def test_execute_connect_error(httpx_mock):
294289
status_code=400,
295290
)
296291

297-
c = AsyncConnectClient('API_KEY', endpoint='https://localhost', use_specs=False)
292+
c = AsyncConnectClient('API_KEY', endpoint='https://localhost')
298293

299294
with pytest.raises(ClientError) as cv:
300295
await c.execute('post', 'resources')
@@ -318,7 +313,7 @@ async def test_execute_unexpected_connect_error(httpx_mock):
318313
status_code=400,
319314
)
320315

321-
c = AsyncConnectClient('API_KEY', endpoint='https://localhost', use_specs=False)
316+
c = AsyncConnectClient('API_KEY', endpoint='https://localhost')
322317

323318
with pytest.raises(ClientError) as cv:
324319
await c.execute('post', 'resources')
@@ -336,7 +331,7 @@ async def test_execute_uparseable_connect_error(httpx_mock):
336331
status_code=400,
337332
)
338333

339-
c = AsyncConnectClient('API_KEY', endpoint='https://localhost', use_specs=False)
334+
c = AsyncConnectClient('API_KEY', endpoint='https://localhost')
340335

341336
with pytest.raises(ClientError):
342337
await c.execute('post', 'resources')
@@ -353,7 +348,7 @@ async def test_execute_error_with_reason(httpx_mock, encoding):
353348
content='Internal Server Error'.encode(encoding),
354349
)
355350

356-
c = AsyncConnectClient('API_KEY', endpoint='https://localhost', use_specs=False)
351+
c = AsyncConnectClient('API_KEY', endpoint='https://localhost')
357352

358353
with pytest.raises(ClientError):
359354
await c.execute('post', 'resources')
@@ -369,20 +364,20 @@ async def test_execute_delete(httpx_mock):
369364
status_code=204,
370365
)
371366

372-
c = AsyncConnectClient('API_KEY', endpoint='https://localhost', use_specs=False)
367+
c = AsyncConnectClient('API_KEY', endpoint='https://localhost')
373368

374369
results = await c.execute('delete', 'resources')
375370

376371
assert results is None
377372

378373

379374
def test_collection():
380-
c = AsyncConnectClient('API_KEY', use_specs=False)
375+
c = AsyncConnectClient('API_KEY')
381376
assert isinstance(c.collection('resources'), AsyncCollection)
382377

383378

384379
def test_ns():
385-
c = AsyncConnectClient('API_KEY', use_specs=False)
380+
c = AsyncConnectClient('API_KEY')
386381
assert isinstance(c.ns('namespace'), AsyncNS)
387382

388383

@@ -395,7 +390,7 @@ async def test_execute_with_qs_and_params(httpx_mock):
395390
status_code=201,
396391
)
397392

398-
c = AsyncConnectClient('API_KEY', endpoint='https://localhost', use_specs=False)
393+
c = AsyncConnectClient('API_KEY', endpoint='https://localhost')
399394
kwargs = {
400395
'params': {
401396
'limit': 100,
@@ -415,7 +410,7 @@ async def test_execute_with_params_only(httpx_mock):
415410
status_code=201,
416411
)
417412

418-
c = AsyncConnectClient('API_KEY', endpoint='https://localhost', use_specs=False)
413+
c = AsyncConnectClient('API_KEY', endpoint='https://localhost')
419414
kwargs = {
420415
'params': {
421416
'limit': 100,

0 commit comments

Comments
 (0)