Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle committed Sep 18, 2024
1 parent 9791633 commit 94994c8
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions tests/integration/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1919,12 +1919,28 @@ def test_delete_raw(client: TestClient, user_access_token: str, internal_study_i
client.headers = {"Authorization": f"Bearer {user_access_token}"}

# =============================
# SET UP
# SET UP + NOMINAL CASES
# =============================

# =============================
# NOMINAL CASES
# =============================
content = io.BytesIO(b"This is the end!")
file_1_path = "user/file_1.txt"
file_2_path = "user/folder/file_2.txt"
for f in [file_1_path, file_2_path]:
# Creates a file / folder inside user folder.
res = client.put(
f"/v1/studies/{internal_study_id}/raw",
params={"path": f, "create_missing": True},
files={"file": content}
)
assert res.status_code == 204, res.json()

# Deletes the file / folder
res = client.delete(f"/v1/studies/{internal_study_id}/raw?path={f}")
assert res.status_code == 200
# Asserts it doesn't exist anymore
res = client.get(f"/v1/studies/{internal_study_id}/raw?path={f}")
assert res.status_code == 404
assert "not a child of User" in res.json()["description"]

# =============================
# ERRORS
Expand Down

0 comments on commit 94994c8

Please sign in to comment.