Skip to content

Commit

Permalink
Add more delete tests using test identities (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
roywilly authored Jun 24, 2024
1 parent 4140a93 commit b96e19a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_access/tst_access_drogon_read_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,23 @@ def test_write(explorer: Explorer):
print("Execution should never reach this line")


def test_delete(explorer: Explorer):
"""Test a delete method"""
print("Running test:", inspect.currentframe().f_code.co_name)

with pytest.raises(Exception, match="403*"):
res = explorer._sumo.delete(f"/objects('dcff880f-b35b-3598-08bc-2a408c85d204')")
print("Execution should never reach this line")
print("Unexpected status: ", res.status_code)
print("Unexpected response: ", res.text)

with pytest.raises(Exception, match="403*"):
res = explorer._sumo.delete(f"/objects('392c3c70-dd1a-41b5-ac49-0e369a0ac4eb')")
print("Execution should never reach this line")
print("Unexpected status: ", res.status_code)
print("Unexpected response: ", res.text)


def test_read_restricted_classification_data(explorer: Explorer):
"""Test if can read restriced data aka 'access:classification: restricted'"""
print("Running test:", inspect.currentframe().f_code.co_name)
Expand Down
15 changes: 15 additions & 0 deletions tests/test_access/tst_access_no_access_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@ def test_write(explorer: Explorer):
print("Unexpected status: ", response.status_code)
print("Unexpected response: ", response.text)

def test_delete(explorer: Explorer):
"""Test a delete method"""
print("Running test:", inspect.currentframe().f_code.co_name)

with pytest.raises(Exception, match="403*"):
res = explorer._sumo.delete(f"/objects('dcff880f-b35b-3598-08bc-2a408c85d204')")
print("Execution should never reach this line")
print("Unexpected status: ", res.status_code)
print("Unexpected response: ", res.text)

with pytest.raises(Exception, match="403*"):
res = explorer._sumo.delete(f"/objects('392c3c70-dd1a-41b5-ac49-0e369a0ac4eb')")
print("Execution should never reach this line")
print("Unexpected status: ", res.status_code)
print("Unexpected response: ", res.text)

def test_read_restricted_classification_data(explorer: Explorer):
"""Test if can read restriced data aka 'access:classification: restricted'"""
Expand Down

0 comments on commit b96e19a

Please sign in to comment.