예제 #1
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)
예제 #2
0
def response_task_reset_post(rf, user, unfinished_task):
    url = reverse('task-reset', kwargs={'uuid': '7f1741b8-6cbd-4de7-b324-8840d643e08a'})

    request = rf.post(url, {
        'description': 'Testing...',
    })
    request.user = user
    request.session = 'session'
    request._messages = FallbackStorage(request)

    task_reset_view = TaskResetView.as_view()
    return task_reset_view(request, uuid='7f1741b8-6cbd-4de7-b324-8840d643e08a')
예제 #3
0
def response_task_reset(rf, user, unfinished_task):
    request = rf.get(reverse('task-reset', kwargs={'uuid': '7f1741b8-6cbd-4de7-b324-8840d643e08a'}))
    request.user = user

    task_reset_view = TaskResetView.as_view()
    return task_reset_view(request, uuid='7f1741b8-6cbd-4de7-b324-8840d643e08a')