File tree Expand file tree Collapse file tree 3 files changed +62
-1
lines changed
Expand file tree Collapse file tree 3 files changed +62
-1
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,12 @@ def adult_report(app_user, dummy_image):
5757def report_photo (adult_report ):
5858 return adult_report .photos .first ()
5959
60+ @pytest .fixture
61+ def report_hidden_photo (report_photo ):
62+ report_photo .hide = True
63+ report_photo .save ()
64+ return report_photo
65+
6066@pytest .fixture
6167def django_live_url (live_server ):
6268 yield live_server .url
Original file line number Diff line number Diff line change @@ -39,3 +39,27 @@ stages:
3939 response :
4040 status_code : 200
4141 json : !force_format_include "{response_data_validation}"
42+
43+
44+ ---
45+
46+ test_name : Hidden photos are not displayed
47+
48+ includes :
49+ - !include schema.yml
50+
51+ marks :
52+ - usefixtures :
53+ - api_live_url
54+ - report_hidden_photo
55+ - token_user_can_view
56+
57+ stages :
58+ - name : User without perm view can retrieve
59+ request :
60+ url : " {api_live_url}/{endpoint}/{report_hidden_photo.uuid}/"
61+ method : " GET"
62+ headers :
63+ Authorization : " Token {token_user_can_view:s}"
64+ response :
65+ status_code : 404
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ stages:
104104
105105---
106106
107- test_name : App user can only retrieve their notifications if not published.
107+ test_name : App user can only retrieve their reports even if not published.
108108
109109includes :
110110 - !include schema.yml
@@ -186,3 +186,34 @@ stages:
186186 response :
187187 status_code : 404
188188
189+
190+ ---
191+
192+ test_name : Hidden photos are not displayed in reports
193+
194+ includes :
195+ - !include schema.yml
196+
197+ marks :
198+ - usefixtures :
199+ - api_live_url
200+ - adult_report
201+ - report_hidden_photo
202+ - token_user_can_view
203+
204+ stages :
205+ - name : User without perm view can retrieve
206+ request :
207+ url : " {api_live_url}/{endpoint}/{adult_report.pk}/"
208+ method : " GET"
209+ headers :
210+ Authorization : " Token {token_user_can_view:s}"
211+ response :
212+ status_code : 200
213+ verify_response_with :
214+ function : tavern.helpers:validate_content
215+ extra_kwargs :
216+ comparisons :
217+ - jmespath : " photos"
218+ operator : " count_eq"
219+ expected : 0
You can’t perform that action at this time.
0 commit comments