Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from django.test import TestCase, tag
from django.urls import reverse

from .helpers.authentication import login_user

@tag("BookAnAppointment")
class TestGetBookAnAppointment(TestCase):
def setUp(self):
self.user = login_user(self.client)

def test_get_redirects_if_the_user_is_not_logged_in(self):
self.client.logout()

response = self.client.get(reverse("questions:book_an_appointment"))

self.assertRedirects(
response,
"/oidc/authenticate/?next=/call-us-to-book-an-appointment",
fetch_redirect_response=False,
)
5 changes: 2 additions & 3 deletions lung_cancer_screening/questions/views/book_an_appointment.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from django.shortcuts import render
from django.views import View
from django.contrib.auth.mixins import LoginRequiredMixin

from .mixins.ensure_response_set import EnsureResponseSet


class BookAnAppointmentExitView(EnsureResponseSet, View):
class BookAnAppointmentExitView(LoginRequiredMixin, View):
def get(self, request):
return render(
request,
Expand Down
Loading