Esempio n. 1
0
def skip(request):
    """Skips the authenticated user's current task."""
    if not request.user.is_authenticated():
        return redirect(login_path(reverse("contribute:index")))

    _assign_task(request.user)
    return redirect("contribute:index")
Esempio n. 2
0
    def test_skip_not_authenticated(self):
        """The view should do nothing and redirect to the log in page if the
            client isn't authenticated."""
        self.client.logout()
        response = self.client.post(reverse("contribute:skip"))

        self.assertRedirects(response, login_path(reverse("contribute:index")))
        self.assertEqual(self.task_count, Task.objects.count())