Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more delete tests using test identities #333

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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