Skip to content

Commit

Permalink
Updates to trace and check tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
rclapp authored and MariusWirtz committed Nov 29, 2023
1 parent 66439a4 commit ca66d43
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
3 changes: 1 addition & 2 deletions TM1py/Services/RestService.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from TM1py.Exceptions.Exceptions import TM1pyTimeout, TM1pyVersionDeprecationException
from TM1py.Utils import case_and_space_insensitive_equals, CaseAndSpaceInsensitiveSet, HTTPAdapterWithSocketOptions, \
decohints
from Utils import verify_version

try:
from requests_negotiate_sspi import HttpNegotiateAuth
Expand Down Expand Up @@ -526,7 +525,7 @@ def _start_session(self, user: str, password: str, decode_b64: bool = False, nam
json=payload)
self.verify_response(response)
if 'TM1SessionId' not in self._s.cookies:
warnings.warn(f"TM1SessionId has failed to be added to the session cookies, future requests "
raise TM1pyException(f"TM1SessionId has failed to be added to the session cookies, future requests "
"using this TM1Service instance will fail due to authentication. "
"Check the tm1-gateway domain settings are correct "
"in the container orchestrator ")
Expand Down
36 changes: 18 additions & 18 deletions Tests/CellService_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4184,7 +4184,7 @@ def test_trace_cell_calculation_no_depth_iterable(self):
cube_name=self.cube_with_rules_name,
elements=["Element1", "Element1", "Element1"])

self.assertEqual(result['@odata.context'], '../$metadata#ibm.tm1.api.v1.CalculationComponent')
self.assertIn('../$metadata#ibm.tm1.api.v1.CalculationComponent', result['@odata.context'])

def test_trace_cell_calculation_shallow_depth_iterable(self):
shallow_depth = 1
Expand All @@ -4193,7 +4193,7 @@ def test_trace_cell_calculation_shallow_depth_iterable(self):
elements=["Element3", "Element1", "Element1"],
depth=shallow_depth)

self.assertEqual(result['@odata.context'], '../$metadata#ibm.tm1.api.v1.CalculationComponent')
self.assertIn('../$metadata#ibm.tm1.api.v1.CalculationComponent', result['@odata.context'])
components = result["Components"]

self.assertNotIn("Components", components)
Expand All @@ -4205,7 +4205,7 @@ def test_trace_cell_calculation_deep_depth_iterable(self):
elements=["Element3", "Element1", "Element1"],
depth=shallow_depth)

self.assertEqual(result['@odata.context'], '../$metadata#ibm.tm1.api.v1.CalculationComponent')
self.assertIn('../$metadata#ibm.tm1.api.v1.CalculationComponent', result['@odata.context'])
components = result["Components"]
for _ in range(shallow_depth - 1):
components = components[0]["Components"]
Expand All @@ -4218,14 +4218,14 @@ def test_trace_cell_calculation_dimensions_iterable(self):
elements=["Element1", "Element1", "Element1"],
dimensions=["TM1py_Tests_Cell_Dimension1", "TM1py_Tests_Cell_Dimension2", "TM1py_Tests_Cell_Dimension3"])

self.assertEqual(result['@odata.context'], '../$metadata#ibm.tm1.api.v1.CalculationComponent')
self.assertIn('../$metadata#ibm.tm1.api.v1.CalculationComponent', result['@odata.context'])

def test_trace_cell_calculation_no_depth_string(self):
result = self.tm1.cells.trace_cell_calculation(
cube_name=self.cube_with_rules_name,
elements="Element1,Element1,Element1")

self.assertEqual(result['@odata.context'], '../$metadata#ibm.tm1.api.v1.CalculationComponent')
self.assertIn('../$metadata#ibm.tm1.api.v1.CalculationComponent', result['@odata.context'])

def test_trace_cell_calculation_shallow_depth_string(self):
shallow_depth = 2
Expand All @@ -4235,7 +4235,7 @@ def test_trace_cell_calculation_shallow_depth_string(self):
elements="Element3,Element1,Element1",
depth=shallow_depth)

self.assertEqual(result['@odata.context'], '../$metadata#ibm.tm1.api.v1.CalculationComponent')
self.assertIn('../$metadata#ibm.tm1.api.v1.CalculationComponent', result['@odata.context'])
components = result["Components"]
for _ in range(shallow_depth - 1):
components = components[0]["Components"]
Expand All @@ -4248,15 +4248,15 @@ def test_trace_cell_calculation_deep_depth_string(self):
elements="Element1,Element1,Element1",
depth=25)

self.assertEqual(result['@odata.context'], '../$metadata#ibm.tm1.api.v1.CalculationComponent')
self.assertIn('../$metadata#ibm.tm1.api.v1.CalculationComponent', result['@odata.context'])

def test_trace_cell_calculation_dimensions_string(self):
result = self.tm1.cells.trace_cell_calculation(
cube_name=self.cube_with_rules_name,
elements="Element1,Element1,Element1",
dimensions=["TM1py_Tests_Cell_Dimension1", "TM1py_Tests_Cell_Dimension2", "TM1py_Tests_Cell_Dimension3"])

self.assertEqual(result['@odata.context'], '../$metadata#ibm.tm1.api.v1.CalculationComponent')
self.assertIn('../$metadata#ibm.tm1.api.v1.CalculationComponent', result['@odata.context'])

def test_trace_cell_calculation_dimensions_string_hierarchy(self):
result = self.tm1.cells.trace_cell_calculation(
Expand All @@ -4266,7 +4266,7 @@ def test_trace_cell_calculation_dimensions_string_hierarchy(self):
"TM1py_Tests_Cell_Dimension3::Element1",
dimensions=["TM1py_Tests_Cell_Dimension1", "TM1py_Tests_Cell_Dimension2", "TM1py_Tests_Cell_Dimension3"])

self.assertEqual(result['@odata.context'], '../$metadata#ibm.tm1.api.v1.CalculationComponent')
self.assertIn('../$metadata#ibm.tm1.api.v1.CalculationComponent', result['@odata.context'])

def test_trace_cell_calculation_dimensions_string_multi_hierarchy(self):
result = self.tm1.cells.trace_cell_calculation(
Expand All @@ -4276,22 +4276,22 @@ def test_trace_cell_calculation_dimensions_string_multi_hierarchy(self):
"TM1py_Tests_Cell_Dimension3::Element1",
dimensions=["TM1py_Tests_Cell_Dimension1", "TM1py_Tests_Cell_Dimension2", "TM1py_Tests_Cell_Dimension3"])

self.assertEqual(result['@odata.context'], '../$metadata#ibm.tm1.api.v1.CalculationComponent')
self.assertIn('../$metadata#ibm.tm1.api.v1.CalculationComponent', result['@odata.context'])

def test_trace_feeders_string(self):
result = self.tm1.cells.trace_cell_feeders(
cube_name=self.cube_with_rules_name,
elements="Element1,Element1,Element1")

self.assertEqual(result['@odata.context'], '../$metadata#ibm.tm1.api.v1.FeederTrace')
self.assertIn('../$metadata#ibm.tm1.api.v1.FeederTrace', result['@odata.context'])

def test_trace_feeders_dimensions_string(self):
result = self.tm1.cells.trace_cell_feeders(
cube_name=self.cube_with_rules_name,
elements="Element1,Element1,Element1",
dimensions=["TM1py_Tests_Cell_Dimension1", "TM1py_Tests_Cell_Dimension2", "TM1py_Tests_Cell_Dimension3"])

self.assertEqual(result['@odata.context'], '../$metadata#ibm.tm1.api.v1.FeederTrace')
self.assertIn('../$metadata#ibm.tm1.api.v1.FeederTrace', result['@odata.context'])

def test_trace_feeders_dimensions_string_hierarchy(self):
result = self.tm1.cells.trace_cell_feeders(
Expand All @@ -4301,7 +4301,7 @@ def test_trace_feeders_dimensions_string_hierarchy(self):
"TM1py_Tests_Cell_Dimension3::Element1",
dimensions=["TM1py_Tests_Cell_Dimension1", "TM1py_Tests_Cell_Dimension2", "TM1py_Tests_Cell_Dimension3"])

self.assertEqual(result['@odata.context'], '../$metadata#ibm.tm1.api.v1.FeederTrace')
self.assertIn('../$metadata#ibm.tm1.api.v1.FeederTrace', result['@odata.context'])

def test_trace_feeders_dimensions_string_multi_hierarchy(self):
result = self.tm1.cells.trace_cell_feeders(
Expand All @@ -4311,22 +4311,22 @@ def test_trace_feeders_dimensions_string_multi_hierarchy(self):
"TM1py_Tests_Cell_Dimension3::Element1",
dimensions=["TM1py_Tests_Cell_Dimension1", "TM1py_Tests_Cell_Dimension2", "TM1py_Tests_Cell_Dimension3"])

self.assertEqual(result['@odata.context'], '../$metadata#ibm.tm1.api.v1.FeederTrace')
self.assertIn('../$metadata#ibm.tm1.api.v1.FeederTrace', result['@odata.context'])

def test_check_feeders_string(self):
result = self.tm1.cells.check_cell_feeders(
cube_name=self.cube_with_rules_name,
elements="Element1,Element1,Element1")

self.assertEqual(result['@odata.context'], '../$metadata#Collection(ibm.tm1.api.v1.FedCellDescriptor)')
self.assertIn('../$metadata#Collection(ibm.tm1.api.v1.FedCellDescriptor)', result['@odata.context'])

def test_check_feeders_dimensions_string(self):
result = self.tm1.cells.check_cell_feeders(
cube_name=self.cube_with_rules_name,
elements="Element1,Element1,Element1",
dimensions=["TM1py_Tests_Cell_Dimension1", "TM1py_Tests_Cell_Dimension2", "TM1py_Tests_Cell_Dimension3"])

self.assertEqual(result['@odata.context'], '../$metadata#Collection(ibm.tm1.api.v1.FedCellDescriptor)')
self.assertIn('../$metadata#Collection(ibm.tm1.api.v1.FedCellDescriptor)', result['@odata.context'])

def test_check_feeders_dimensions_string_hierarchy(self):
result = self.tm1.cells.check_cell_feeders(
Expand All @@ -4336,7 +4336,7 @@ def test_check_feeders_dimensions_string_hierarchy(self):
"TM1py_Tests_Cell_Dimension3::Element1",
dimensions=["TM1py_Tests_Cell_Dimension1", "TM1py_Tests_Cell_Dimension2", "TM1py_Tests_Cell_Dimension3"])

self.assertEqual(result['@odata.context'], '../$metadata#Collection(ibm.tm1.api.v1.FedCellDescriptor)')
self.assertIn('../$metadata#Collection(ibm.tm1.api.v1.FedCellDescriptor)', result['@odata.context'])

def test_check_feeders_dimensions_string_multi_hierarchy(self):
result = self.tm1.cells.check_cell_feeders(
Expand All @@ -4346,7 +4346,7 @@ def test_check_feeders_dimensions_string_multi_hierarchy(self):
"TM1py_Tests_Cell_Dimension3::Element1",
dimensions=["TM1py_Tests_Cell_Dimension1", "TM1py_Tests_Cell_Dimension2", "TM1py_Tests_Cell_Dimension3"])

self.assertEqual(result['@odata.context'], '../$metadata#Collection(ibm.tm1.api.v1.FedCellDescriptor)')
self.assertIn('../$metadata#Collection(ibm.tm1.api.v1.FedCellDescriptor)', result['@odata.context'])

def test_execute_mdx_csv_mdx_headers(self):
self.tm1.cubes.cells.write_values(
Expand Down

0 comments on commit ca66d43

Please sign in to comment.