Skip to content

Commit 2d8fabb

Browse files
committed
fix unit test after moving to CreateEntitiesAPI
1 parent 61a7095 commit 2d8fabb

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

tests/unit/data/test_odata_internal.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2901,7 +2901,7 @@ def setUp(self):
29012901

29022902
def _body(self, **kwargs):
29032903
req = self.od._build_create_entity("new_TestTable", {}, **kwargs)
2904-
return json.loads(req.body)
2904+
return json.loads(req.body)["Entities"][0]
29052905

29062906
def test_display_name_used_in_payload_when_provided(self):
29072907
"""_build_create_entity uses the provided display_name in DisplayName."""
@@ -2941,9 +2941,9 @@ def test_returns_post_request(self):
29412941
self.assertEqual(req.method, "POST")
29422942

29432943
def test_url_targets_entity_definitions(self):
2944-
"""_build_create_entity URL ends with /EntityDefinitions."""
2944+
"""_build_create_entity URL ends with /CreateEntities."""
29452945
req = self.od._build_create_entity("new_TestTable", {})
2946-
self.assertTrue(req.url.endswith("/EntityDefinitions"))
2946+
self.assertTrue(req.url.endswith("/CreateEntities"))
29472947

29482948
def test_solution_appended_to_url(self):
29492949
"""_build_create_entity appends SolutionUniqueName to URL when solution is given."""
@@ -2988,15 +2988,15 @@ def test_primary_column_derived_from_table_prefix(self):
29882988
def test_primary_column_explicit(self):
29892989
"""_build_create_entity uses explicit primary_column when provided."""
29902990
req = self.od._build_create_entity("new_TestTable", {}, primary_column="new_CustomName")
2991-
body = json.loads(req.body)
2991+
body = json.loads(req.body)["Entities"][0]
29922992
attrs = body["Attributes"]
29932993
primary = next(a for a in attrs if a.get("IsPrimaryName"))
29942994
self.assertEqual(primary["SchemaName"], "new_CustomName")
29952995

29962996
def test_primary_column_derived_no_prefix(self):
29972997
"""Primary column defaults to 'new_Name' when table has no underscore."""
29982998
req = self.od._build_create_entity("TestTable", {})
2999-
body = json.loads(req.body)
2999+
body = json.loads(req.body)["Entities"][0]
30003000
primary = next(a for a in body["Attributes"] if a.get("IsPrimaryName"))
30013001
self.assertEqual(primary["SchemaName"], "new_Name")
30023002

@@ -3007,7 +3007,7 @@ def test_columns_included_in_attributes(self):
30073007
body = (
30083008
self._body.__func__(self, **{})
30093009
if False
3010-
else json.loads(self.od._build_create_entity("new_TestTable", {"new_Price": "decimal"}).body)
3010+
else json.loads(self.od._build_create_entity("new_TestTable", {"new_Price": "decimal"}).body)["Entities"][0]
30113011
)
30123012
schemas = [a["SchemaName"] for a in body["Attributes"]]
30133013
self.assertIn("new_Price", schemas)

0 commit comments

Comments
 (0)