def test_cant_see_unfinished_issues_from_another_user(self, request_unfinished_tasks, unfinished_tasks): unfinished_tasks[0].user = UserFactory.create(username='******') unfinished_tasks[0].save() task_list_view = TaskListView.as_view() response = task_list_view(request_unfinished_tasks) assert len(response.context_data['task_list']) == 0
def test_dont_reset_tasks_from_another_user(self, rf, user, unfinished_task): unfinished_task.user = UserFactory.create(username='******') unfinished_task.save() request = rf.post(reverse('task-reset', kwargs={'uuid': 1})) request.user = user task_reset_view = TaskResetView.as_view() pytest.raises(Http404, task_reset_view, request, uuid=1)
def test_dont_finish_a_task_from_another_user(self, rf, user, unfinished_task): unfinished_task.user = UserFactory.create(username="******") unfinished_task.save() request = rf.get(reverse("task-done", kwargs={"uuid": 1})) request.user = user task_done_view = TaskDoneView.as_view() pytest.raises(Http404, task_done_view, request, uuid=1)
def test_dont_remove_a_task_from_another_user(self, rf, user, finished_tasks): finished_tasks[0].uuid = 1 finished_tasks[0].user = UserFactory.create(username="******") finished_tasks[0].save() request = rf.get(reverse("task-delete", kwargs={"uuid": 1})) request.user = user request.session = "session" request._messages = FallbackStorage(request) task_delete_view = TaskDeleteView.as_view() pytest.raises(Http404, task_delete_view, request, uuid=1)
def another_user_task(unfinished_tasks): unfinished_tasks[0].user = UserFactory.create(username='******') unfinished_tasks[0].save() return unfinished_tasks[0]