Skip to content

Commit

Permalink
add test for edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonGrace2282 committed Oct 19, 2024
1 parent dc077f0 commit 507222f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tin/apps/assignments/tests/test_file_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_create_file_action_view(client, course) -> None:
fa_data = model_to_dict(file_action)

# try copying the data
response = client.post(f"{url}?action={file_action.id}", {**fa_data, "copy": True})
response = client.post(f"{url}?action={file_action.id}", fa_data | {"copy": True})
assert (
course.file_actions.count() == 2
), "Passing copy as a POST parameter should copy the file action"
Expand All @@ -54,6 +54,11 @@ def test_create_file_action_view(client, course) -> None:
file_action.refresh_from_db()
assert file_action.name == "New name!"

response = client.post(f"{url}?copy=1", fa_data)
assert (
course.file_actions.count() == 3
), f"Passing copy without an action should create a file action (got {response})"


@login("teacher")
def test_delete_file_action_view(client, course, file_action) -> None:
Expand Down

0 comments on commit 507222f

Please sign in to comment.