2626from django .urls import reverse , NoReverseMatch
2727from omeroweb .api import api_settings
2828from django .test import Client
29+ from django .test .client import MULTIPART_CONTENT
2930from omero_marshal import OME_SCHEMA_URL
3031
3132
@@ -155,7 +156,9 @@ def test_login_invalid_csrf_token(self):
155156 "Password: This field is required. "
156157 "Server: This field is required." )]
157158 ])
158- def test_login_errors (self , credentials ):
159+ @pytest .mark .parametrize ("content_type" , (
160+ MULTIPART_CONTENT , "application/json" ))
161+ def test_login_errors (self , credentials , content_type ):
159162 """
160163 Tests that we get expected form validation errors if try to login
161164 without required fields, as 'guest' or with invalid username/password.
@@ -168,7 +171,8 @@ def test_login_errors(self, credentials):
168171 rsp = client .post (
169172 self .get_login_url (),
170173 data ,
171- headers = {"X-CSRFToken" : csrf_token })
174+ headers = {"X-CSRFToken" : csrf_token },
175+ content_type = content_type )
172176 assert rsp .status_code == 403
173177 assert rsp .json ()['message' ] == message
174178
0 commit comments