Skip to content

Commit e34866e

Browse files
update auth tests
1 parent 11e0ffb commit e34866e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/test_auth.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def _count_users(self):
3333
with self.client.application.app_context():
3434
return User.query.count()
3535

36-
def _test_invalid_request_data(self, endpoint, expected_status=400):
36+
def _test_invalid_request_data(self, endpoint, expected_status=422):
3737
response = self.client.post(endpoint, json={})
3838
assert response.status_code == expected_status
3939

@@ -44,7 +44,7 @@ def _test_invalid_request_data(self, endpoint, expected_status=400):
4444
assert response.status_code == expected_status
4545

4646
response = self.client.post(endpoint, data="not json data")
47-
assert response.status_code == 415
47+
assert response.status_code == expected_status
4848

4949
def _decode_token(self, token):
5050
# Needs Flask app context for secret/algorithms from current_app.config
@@ -97,7 +97,7 @@ def test_register_invalid_email_format(self, register_user):
9797
invalid_email = "not-an-email"
9898
response = register_user(invalid_email, self.TEST_PASSWORD)
9999

100-
assert response.status_code == 400
100+
assert response.status_code == 422
101101
data = response.get_json()
102102
assert data["code"] == "invalid_email_format"
103103
assert "error" in data
@@ -125,7 +125,7 @@ def test_login_invalid_password(self, register_user, login_user):
125125
response = login_user(self.TEST_EMAIL, "wrongpassword")
126126

127127
assert response.status_code == 401
128-
assert b"Invalid username or password" in response.data
128+
assert b"Invalid email or password" in response.data
129129

130130
def test_login_invalid_data(self):
131131
self._test_invalid_request_data("/auth/login")

0 commit comments

Comments
 (0)