Skip to content

Commit 009461f

Browse files
authored
Revert "[ELUSoC'26] Add authentication tests for invalid credentials and duplicate signups"
1 parent 1023154 commit 009461f

1 file changed

Lines changed: 14 additions & 38 deletions

File tree

backend/tests/test_auth.py

Lines changed: 14 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ def test_signup_duplicate_email(self, client, json_headers):
9595
# Second signup with the same email should fail (usually 400 or 409 Conflict)
9696
resp = client.post("/signup", headers=json_headers, json=payload)
9797
assert resp.status_code in [400, 409]
98-
99-
100-
10198

10299

103100
class TestLogin:
@@ -136,39 +133,18 @@ def test_login_empty_body(self, client, json_headers):
136133

137134
assert resp.status_code == 400
138135

139-
140-
def test_login_nonexistent_user(self, client, json_headers):
141-
response = client.post(
142-
"/login",
143-
headers=json_headers,
144-
json={
145-
"email": "nouser@example.com",
146-
"password": "password123",
147-
},
148-
)
149-
150-
assert response.status_code == 401
136+
# 🛠️ NEW TESTS FOR ISSUE #119
151137
def test_login_invalid_password(self, client, json_headers):
152-
client.post(
153-
"/signup",
154-
headers=json_headers,
155-
json={
156-
"name": "Test User",
157-
"email": "test@example.com",
158-
"password": "correct123",
159-
},
160-
)
161-
162-
response = client.post(
163-
"/login",
164-
headers=json_headers,
165-
json={
166-
"email": "test@example.com",
167-
"password": "wrong123",
168-
},
169-
)
170-
171-
assert response.status_code == 401
172-
173-
174-
138+
"""Login with incorrect password returns 401 Unauthorized."""
139+
payload = {"email": "priya@example.com", "password": "wrongpassword"}
140+
resp = client.post("/login", headers=json_headers, json=payload)
141+
142+
# Checking against standard auth denial codes (401 is most common)
143+
assert resp.status_code in [400, 401]
144+
145+
def test_login_unregistered_email(self, client, json_headers):
146+
"""Login with unregistered email returns 401 or 404."""
147+
payload = {"email": "nobody@example.com", "password": "securePass123"}
148+
resp = client.post("/login", headers=json_headers, json=payload)
149+
150+
assert resp.status_code in [400, 401, 404]

0 commit comments

Comments
 (0)