Skip to content

Commit 1868980

Browse files
mamiksikfilak-sap
authored andcommitted
tests: fix navigation prop multiplicity test
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 #117.
1 parent 3c8d03f commit 1868980

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1515
### Fixed
1616
- URL encode $filter contents - Barton Ip
1717
- JSON errors caused by invalid content length of Batch responses - Barton Ip
18+
- Invalid test case - test_create_entity_nested_list - Martin Miksik
1819

1920
### Changed
2021
- ODataHttpResponse.from_string produces header of type {header: value} instead of [(header, value)] - Martin Miksik

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)