Skip to content

Commit

Permalink
Add tests for bulk aggregation
Browse files Browse the repository at this point in the history
  • Loading branch information
roywilly committed Feb 8, 2024
1 parent 47885ca commit af17a97
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 4 deletions.
22 changes: 21 additions & 1 deletion tests/test_access/tst_access_drogon_manage_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,26 @@ def test_read_restricted_classification_data(explorer: Explorer):
print("Hits on restricted:", hits)
assert hits > 0

# TODO: aggregate bulk operation should fail

def test_aggregate_bulk(explorer: Explorer):
"""Test a bulk aggregation method"""
print("Running test:", inspect.currentframe().f_code.co_name)
cases = explorer.cases
print("Number of cases: ", len(cases))
assert len(cases) > 0
case = cases[0]
case_uuid = case.metadata.get("fmu").get("case").get("uuid")
print("About to trigger aggregation on case", case_uuid)
body = {
"operations": [ "min" ],
"case_uuid": case_uuid,
"class": "surface",
"iteration_name": "iter-0"
}
response = explorer._sumo.post(f"/aggregations", json=body)
print(response.status_code)
assert response.status_code == 200
assert response.json().get("batchType") == "batch"


# TODO: FAST aggregate operation should succeed
21 changes: 20 additions & 1 deletion tests/test_access/tst_access_drogon_read_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,25 @@ def test_read_restricted_classification_data(explorer: Explorer):
print("Hits on restricted:", hits)
assert hits == 0

# TODO: aggregate bulk operation should fail
def test_aggregate_bulk(explorer: Explorer):
"""Test a bulk aggregation method"""
print("Running test:", inspect.currentframe().f_code.co_name)
cases = explorer.cases
print("Number of cases: ", len(cases))
assert len(cases) > 0
case = cases[0]
case_uuid = case.metadata.get("fmu").get("case").get("uuid")
print("About to trigger aggregation on case", case_uuid)
body = {
"operations": [ "min" ],
"case_uuid": case_uuid,
"class": "surface",
"iteration_name": "iter-0"
}
response = explorer._sumo.post(f"/aggregations", json=body)
print(response.status_code)
assert response.status_code == 200
assert response.json().get("batchType") == "batch"
# TODO SHould fail

# TODO: FAST aggregate operation should succeed
21 changes: 20 additions & 1 deletion tests/test_access/tst_access_drogon_write_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,25 @@ def test_read_restricted_classification_data(explorer: Explorer):
print("Hits on restricted:", hits)
assert hits > 0

# TODO: aggregate bulk operation should fail
def test_aggregate_bulk(explorer: Explorer):
"""Test a bulk aggregation method"""
print("Running test:", inspect.currentframe().f_code.co_name)
cases = explorer.cases
print("Number of cases: ", len(cases))
assert len(cases) > 0
case = cases[0]
case_uuid = case.metadata.get("fmu").get("case").get("uuid")
print("About to trigger aggregation on case", case_uuid)
body = {
"operations": [ "min" ],
"case_uuid": case_uuid,
"class": "surface",
"iteration_name": "iter-0"
}
response = explorer._sumo.post(f"/aggregations", json=body)
print(response.status_code)
assert response.status_code == 200
assert response.json().get("batchType") == "batch"


# TODO: FAST aggregate operation should succeed
19 changes: 18 additions & 1 deletion tests/test_access/tst_access_no_access_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,23 @@ def test_read_restricted_classification_data(explorer: Explorer):
assert hits == 0


# TODO: aggregate bulk operation should fail
def test_aggregate_bulk(explorer: Explorer):
"""Test a bulk aggregation method"""
print("Running test:", inspect.currentframe().f_code.co_name)
# Fixed test case ("Drogon_AHM_2023-02-22") in Sumo/DEV
TESTCASE_UUID = "10f41041-2c17-4374-a735-bb0de62e29dc"
print("About to trigger aggregation on case", TESTCASE_UUID)
body = {
"operations": [ "min" ],
"case_uuid": TESTCASE_UUID,
"class": "surface",
"iteration_name": "iter-0"
}
response = explorer._sumo.post(f"/aggregations", json=body)
print(response.status_code)
assert response.status_code == 200
assert response.json().get("batchType") == "batch"
# TODO: Should fail


# TODO: FAST aggregate operation should succeed

0 comments on commit af17a97

Please sign in to comment.