From 8bbbaec9df435fd5747bacece1bcb2ec5be362c6 Mon Sep 17 00:00:00 2001 From: Gaute Lindkvist Date: Tue, 4 Jun 2019 13:26:30 +0200 Subject: [PATCH] gRPC: multi-case test --- .../GrpcInterface/Python/tests/test_cases.py | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/GrpcInterface/Python/tests/test_cases.py b/ApplicationCode/GrpcInterface/Python/tests/test_cases.py index 6f718008f6..b5c0ed24d7 100644 --- a/ApplicationCode/GrpcInterface/Python/tests/test_cases.py +++ b/ApplicationCode/GrpcInterface/Python/tests/test_cases.py @@ -16,4 +16,28 @@ def test_EmptyProject(rips_instance): def test_OneCase(rips_instance): case = rips_instance.project.loadCase(dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID") cases = rips_instance.project.cases() - assert(len(cases) is 1) \ No newline at end of file + assert(len(cases) is 1) + +def test_MultipleCases(rips_instance): + casePaths = [] + casePaths.append(dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID") + casePaths.append(dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID") + casePaths.append(dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID") + casePaths.append(dataroot.PATH + "/case_with_10_timesteps/Real0/BRUGGE_0000.EGRID") + casePaths.append(dataroot.PATH + "/case_with_10_timesteps/Real10/BRUGGE_0010.EGRID") + casePaths.append(dataroot.PATH + "/case_with_10_timesteps/Real20/BRUGGE_0020.EGRID") + + caseNames = [] + for casePath in casePaths: + caseName = os.path.splitext(os.path.basename(casePath))[0] + caseNames.append(caseName) + rips_instance.project.loadCase(path=casePath) + + print(caseNames) + cases = rips_instance.project.cases() + for case in cases: + print (case.index, case.name) + assert(len(cases) == len(caseNames)) + for i, caseName in enumerate(caseNames): + print(i, caseName) + assert(caseName == cases[i].name)