99
1010@pytest .mark .django_db
1111class TestShowAppointment :
12- def test_redirects_if_in_progress (self , logged_in_client , appointment ):
13- response = logged_in_client .get (
12+ def test_redirects_to_show_screening_if_in_progress (
13+ self , clinical_user_client , appointment
14+ ):
15+ response = clinical_user_client .get (
1416 reverse ("mammograms:show_appointment" , kwargs = {"pk" : appointment .pk })
1517 )
1618 assertRedirects (
@@ -21,8 +23,16 @@ def test_redirects_if_in_progress(self, logged_in_client, appointment):
2123 ),
2224 )
2325
24- def test_renders_response (self , logged_in_client , completed_appointment ):
25- response = logged_in_client .get (
26+ def test_doesnt_redirect_if_not_permitted (
27+ self , administrative_user_client , appointment
28+ ):
29+ response = administrative_user_client .get (
30+ reverse ("mammograms:show_appointment" , kwargs = {"pk" : appointment .pk })
31+ )
32+ assert response .status_code == 200
33+
34+ def test_renders_response (self , clinical_user_client , completed_appointment ):
35+ response = clinical_user_client .get (
2636 reverse (
2737 "mammograms:show_appointment" , kwargs = {"pk" : completed_appointment .pk }
2838 )
@@ -32,8 +42,8 @@ def test_renders_response(self, logged_in_client, completed_appointment):
3242
3343@pytest .mark .django_db
3444class TestStartScreening :
35- def test_appointment_continued (self , logged_in_client , appointment ):
36- response = logged_in_client .post (
45+ def test_appointment_continued (self , clinical_user_client , appointment ):
46+ response = clinical_user_client .post (
3747 reverse ("mammograms:start_screening" , kwargs = {"pk" : appointment .pk }),
3848 {"decision" : "continue" },
3949 )
@@ -45,8 +55,8 @@ def test_appointment_continued(self, logged_in_client, appointment):
4555 ),
4656 )
4757
48- def test_appointment_stopped (self , logged_in_client , appointment ):
49- response = logged_in_client .post (
58+ def test_appointment_stopped (self , clinical_user_client , appointment ):
59+ response = clinical_user_client .post (
5060 reverse ("mammograms:start_screening" , kwargs = {"pk" : appointment .pk }),
5161 {"decision" : "dropout" },
5262 )
@@ -59,9 +69,9 @@ def test_appointment_stopped(self, logged_in_client, appointment):
5969 )
6070
6171 def test_already_completed_appointment_redirects (
62- self , logged_in_client , completed_appointment
72+ self , clinical_user_client , completed_appointment
6373 ):
64- response = logged_in_client .get (
74+ response = clinical_user_client .get (
6575 reverse (
6676 "mammograms:start_screening" , kwargs = {"pk" : completed_appointment .pk }
6777 )
@@ -74,8 +84,8 @@ def test_already_completed_appointment_redirects(
7484 ),
7585 )
7686
77- def test_renders_invalid_form (self , logged_in_client , appointment ):
78- response = logged_in_client .post (
87+ def test_renders_invalid_form (self , clinical_user_client , appointment ):
88+ response = clinical_user_client .post (
7989 reverse ("mammograms:start_screening" , kwargs = {"pk" : appointment .pk }),
8090 {},
8191 )
@@ -84,8 +94,8 @@ def test_renders_invalid_form(self, logged_in_client, appointment):
8494
8595@pytest .mark .django_db
8696class TestAskForMedicalInformation :
87- def test_continue_to_record (self , logged_in_client , appointment ):
88- response = logged_in_client .post (
97+ def test_continue_to_record (self , clinical_user_client , appointment ):
98+ response = clinical_user_client .post (
8999 reverse (
90100 "mammograms:ask_for_medical_information" ,
91101 kwargs = {"pk" : appointment .pk },
@@ -100,8 +110,8 @@ def test_continue_to_record(self, logged_in_client, appointment):
100110 ),
101111 )
102112
103- def test_continue_to_imaging (self , logged_in_client , appointment ):
104- response = logged_in_client .post (
113+ def test_continue_to_imaging (self , clinical_user_client , appointment ):
114+ response = clinical_user_client .post (
105115 reverse (
106116 "mammograms:ask_for_medical_information" ,
107117 kwargs = {"pk" : appointment .pk },
@@ -116,8 +126,8 @@ def test_continue_to_imaging(self, logged_in_client, appointment):
116126 ),
117127 )
118128
119- def test_renders_invalid_form (self , logged_in_client , appointment ):
120- response = logged_in_client .post (
129+ def test_renders_invalid_form (self , clinical_user_client , appointment ):
130+ response = clinical_user_client .post (
121131 reverse (
122132 "mammograms:ask_for_medical_information" ,
123133 kwargs = {"pk" : appointment .pk },
@@ -129,17 +139,17 @@ def test_renders_invalid_form(self, logged_in_client, appointment):
129139
130140@pytest .mark .django_db
131141class TestCheckIn :
132- def test_known_redirect (self , logged_in_client , appointment ):
133- response = logged_in_client .post (
142+ def test_known_redirect (self , clinical_user_client , appointment ):
143+ response = clinical_user_client .post (
134144 reverse ("mammograms:check_in" , kwargs = {"pk" : appointment .pk })
135145 )
136146 assertRedirects (
137147 response ,
138148 reverse ("mammograms:start_screening" , kwargs = {"pk" : appointment .pk }),
139149 )
140150
141- def test_audit (self , logged_in_client , appointment ):
142- logged_in_client .post (
151+ def test_audit (self , clinical_user_client , appointment ):
152+ clinical_user_client .post (
143153 reverse ("mammograms:check_in" , kwargs = {"pk" : appointment .pk })
144154 )
145155 assert (
@@ -153,8 +163,8 @@ def test_audit(self, logged_in_client, appointment):
153163
154164@pytest .mark .django_db
155165class TestAppointmentCannotGoAhead :
156- def test_audit (self , logged_in_client , appointment ):
157- logged_in_client .post (
166+ def test_audit (self , clinical_user_client , appointment ):
167+ clinical_user_client .post (
158168 reverse (
159169 "mammograms:appointment_cannot_go_ahead" , kwargs = {"pk" : appointment .pk }
160170 ),
0 commit comments