Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
test(apps/tasks): add tests related to the task access
Browse files Browse the repository at this point in the history
test(apps/tasks): add test to access task that is not accessible

test(apps/tasks): add test to access task that is accessible
  • Loading branch information
bitterteriyaki committed Nov 27, 2023
1 parent fabdf35 commit c79c4fb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions apps/tasks/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,14 @@ def test_send_submission_is_redirecting(self) -> None:
def test_send_submission_without_authentication(self) -> None:
response = self.client.post(self.url, data={"code": self.code})
self.assertEqual(response.status_code, 302)

def test_access_task_that_is_accessible(self) -> None:
response = self.client.get(self.url)
self.assertEqual(response.status_code, 200)

def test_access_task_that_is_not_accessible(self) -> None:
self.task.contest.cancelled = True
self.task.contest.save()

response = self.client.get(self.url)
self.assertEqual(response.status_code, 302)

0 comments on commit c79c4fb

Please sign in to comment.