Skip to content

Commit

Permalink
Add an explicit test for withdrawing an already withdrawn file
Browse files Browse the repository at this point in the history
  • Loading branch information
rebkwok committed Sep 4, 2024
1 parent 1dce6de commit c7dec68
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/unit/test_business_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,28 @@ def test_withdraw_file_from_request_not_author(bll, status):
)


def test_withdraw_file_from_request_already_withdrawn(bll):
author = factories.create_user(username="author", workspaces=["workspace"])
release_request = factories.create_request_at_status(
"workspace",
author=author,
status=RequestStatus.RETURNED,
files=[
factories.request_file(group="group", path="foo.txt", approved=True),
factories.request_file(
group="group", path="withdrawn.txt", filetype=RequestFileType.WITHDRAWN
),
],
)

with pytest.raises(
exceptions.RequestPermissionDenied, match="already been withdrawn"
):
bll.withdraw_file_from_request(
release_request, UrlPath("group/withdrawn.txt"), user=author
)


def _get_request_file(release_request, path):
"""Syntactic sugar to make the tests a little more readable"""
# refresh
Expand Down

0 comments on commit c7dec68

Please sign in to comment.