Skip to content

Commit 4f09720

Browse files
committed
Extend test_login_errors with JSON content type
1 parent b40ab99 commit 4f09720

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

components/tools/OmeroWeb/test/integration/test_api_login.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from django.urls import reverse, NoReverseMatch
2727
from omeroweb.api import api_settings
2828
from django.test import Client
29+
from django.test.client import MULTIPART_CONTENT
2930
from 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

Comments
 (0)