Skip to content

Commit 5676565

Browse files
author
Anton Benkevich
committed
Backup, adding more tests
1 parent 6205ec5 commit 5676565

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

almdrlib/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,10 +829,10 @@ def add_xof(item):
829829
else:
830830
return item
831831

832-
allprops = reduce(lambda acc, s: acc + list(s.get(OpenAPIKeyWord.PROPERTIES).items()), compound_schema, [])
832+
allprops = reduce(lambda acc, s: acc + list(s.get(OpenAPIKeyWord.PROPERTIES, {}).items()), compound_schema, [])
833833
reduced = reduce(reduce_props, allprops, OrderedDict())
834834
compound_props = OrderedDict(map(add_xof, reduced.items()))
835-
properties = compound_props
835+
properties = compound_props
836836

837837
if not properties:
838838
properties = OrderedDict({

tests/apis/testapi/testapi.v1.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,35 @@ servers:
1616
description: integration
1717
x-alertlogic-session-endpoint: true
1818
paths:
19+
'/testapi/v1/postdata':
20+
post:
21+
operationId: post_data_compound
22+
requestBody:
23+
content:
24+
application/json:
25+
schema:
26+
oneOf:
27+
- type: object
28+
properties:
29+
prop:
30+
type: string
31+
additionalProperties: true
32+
- type: object
33+
properties:
34+
prop:
35+
type: integer
36+
- type: string
37+
responses:
38+
'200':
39+
description: 200 resp
40+
content:
41+
application/json:
42+
schema:
43+
type: object
44+
properties:
45+
prop:
46+
type: string
47+
1948
'/testapi/v1/{account_id}/test_get_data':
2049
get:
2150
summary: Test Get Data Operation

tests/test_open_api_support.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,9 @@ def test_003_default_objects_creation(self):
8383
self.assertIsInstance(Session(), Session)
8484
self.assertIsInstance(Config(), Config)
8585
self.assertIsInstance(Client(self._service_name), Client)
86+
87+
def test_004_test_operations_compound_schema(self):
88+
"""Test Operations Schema Validity."""
89+
client = Client(self._service_name)
90+
operation = client.operations.get('post_data_compound')
91+
print("PARAMSSSSS:", operation.body._parameters)

0 commit comments

Comments
 (0)