Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
roywilly committed Feb 8, 2024
1 parent 322c63a commit f728e3c
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 20 deletions.
1 change: 0 additions & 1 deletion tests/test_access/tst_access_drogon_manage_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ def test_aggregations_bulk(explorer: Explorer):
}
response = explorer._sumo.post(f"/aggregations", json=body)
print(response.status_code)
print(response.text)
assert response.status_code == 200
assert response.json().get("batchType") == "batch"

Expand Down
38 changes: 21 additions & 17 deletions tests/test_access/tst_access_drogon_read_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,46 +93,50 @@ def test_read_restricted_classification_data(explorer: Explorer):
print("Hits on restricted:", hits)
assert hits == 0

def test_aggregate_bulk(explorer: Explorer):
"""Test a bulk aggregation method"""

def test_aggregations_fast(explorer: Explorer):
"""Test a fast 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)
print("About to trigger fast-aggregation on case", case_uuid)
surface_uuid = cases[0].surfaces[0].uuid
print("using object_id of first surface:", surface_uuid)
body = {
"operations": [ "min" ],
"case_uuid": case_uuid,
"object_ids": [ surface_uuid ],
"class": "surface",
"iteration_name": "iter-0"
}
response = explorer._sumo.post(f"/aggregations", json=body)
print(response.status_code)
print(response.text)
assert response.status_code == 200
assert response.json().get("batchType") == "batch"
print("TODO SHOULD FAIL")
assert response.status_code in [200, 201, 202]
print(len(response.text))

def test_aggregations_fast(explorer: Explorer):
"""Test a fast aggregation method"""

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 fast-aggregation on case", case_uuid)
surface_uuid = cases[0].surfaces[0].uuid
print("using object_id of first surface:", surface_uuid)
print("About to trigger aggregation on case", case_uuid)
body = {
"operations": [ "min" ],
"object_ids": [ surface_uuid ],
"case_uuid": case_uuid,
"class": "surface",
"iteration_name": "iter-0"
"iteration_name": case.iterations[0].get("name")
}
print("lkjlkjlkjlkjlkj", case.iterations[0].get("name"))
response = explorer._sumo.post(f"/aggregations", json=body)
print(response.status_code)
assert response.status_code == 200
print(len(response.text))
print(response.text)
assert response.status_code not in [200, 201, 202]
assert response.json().get("batchType") != "batch"
print("TODO SHOULD FAIL")

1 change: 0 additions & 1 deletion tests/test_access/tst_access_drogon_write_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ def test_aggregate_bulk(explorer: Explorer):
}
response = explorer._sumo.post(f"/aggregations", json=body)
print(response.status_code)
print(response.text)
assert response.status_code == 200
assert response.json().get("batchType") == "batch"

Expand Down
35 changes: 34 additions & 1 deletion tests/test_access/tst_access_no_access_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,42 @@ def test_get_access_log(explorer: Explorer):
print(response.status_code)
print(response.text)
print(len(response.text))
print("TODO SHOULD FAIL????")
# Currently all authenticated users have access
assert response.status_code == 200

def test_get_key(explorer: Explorer):
"""Test to get key method"""
print("Running test:", inspect.currentframe().f_code.co_name)
print("About to get key ")
response = explorer._sumo.post(f"/key")
print(response.status_code)
print(response.text)
print(len(response.text))
print("TODO SHOULD FAIL")
# assert response.status_code == 999

def test_get_purge(explorer: Explorer):
"""Test to get purge method"""
print("Running test:", inspect.currentframe().f_code.co_name)
print("About to get purge ")
response = explorer._sumo.post(f"/purge")
print(response.status_code)
print(response.text)
print(len(response.text))
print("TODO should fail")
# assert response.status_code == 999

def test_get_message_log_truncate(explorer: Explorer):
"""Test to get msg log truncate method"""
print("Running test:", inspect.currentframe().f_code.co_name)
print("About to get msg log truncate ")
response = explorer._sumo.post(f"/message-log/truncate?cutoff=99")
print(response.status_code)
print(response.text)
print(len(response.text))
print("TODO should fail")
# assert response.status_code == 999


def test_aggregate_bulk(explorer: Explorer):
"""Test a bulk aggregation method"""
Expand Down

0 comments on commit f728e3c

Please sign in to comment.