Skip to content

Commit 079ae20

Browse files
committed
Fix invalid test case - test_create_entity_nested_list
Change test entity from Car to Customer, since car can only have one navigation property. A check for correct multiplicity is needed As described in SAP#117.
1 parent 35b333d commit 079ae20

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

tests/test_service_v2.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -172,20 +172,21 @@ def test_create_entity_nested_list(service):
172172

173173
responses.add(
174174
responses.POST,
175-
"{0}/Cars".format(service.url),
175+
"{0}/Customers".format(service.url),
176176
headers={'Content-type': 'application/json'},
177177
json={'d': {
178-
'Name': 'Hadraplan',
179-
'IDPic': [{
180-
'CarName': 'Hadraplan-Plus'
181-
}]
178+
'Name': 'John',
179+
'Orders': [
180+
{'Owner': 'Mammon'},
181+
{'Owner': 'Tomas'},
182+
]
182183
}},
183184
status=201)
184185

185-
entity = {'Name': 'Hadraplan', 'IDPic' : [{'CarName': 'Hadraplan-Plus'}]}
186-
result = service.entity_sets.Cars.create_entity().set(**entity).execute()
186+
entity = {'Name': 'John', 'Orders': [{'Owner': 'Mammon'}, {'Owner': 'Tomas'}]}
187+
result = service.entity_sets.Customers.create_entity().set(**entity).execute()
187188

188-
assert responses.calls[0].request.body == '{"Name": "Hadraplan", "IDPic": [{"CarName": "Hadraplan-Plus"}]}'
189+
assert responses.calls[0].request.body == '{"Name": "John", "Orders": [{"Owner": "Mammon"}, {"Owner": "Tomas"}]}'
189190

190191
@responses.activate
191192
def test_get_entity_property(service):

0 commit comments

Comments
 (0)