File tree Expand file tree Collapse file tree
auth_platform/auth_platform_tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 170170 "filename": "auth_platform/auth_platform_tests/test_auth.py",
171171 "hashed_secret": "9d4e1e23bd5b727046a9e3b4b7db57bd8d6ee684",
172172 "is_verified": false,
173- "line_number": 51
173+ "line_number": 57
174174 },
175175 {
176176 "type": "Secret Keyword",
177177 "filename": "auth_platform/auth_platform_tests/test_auth.py",
178178 "hashed_secret": "df9dd14cbdb3b00f8a54b66f489241e8aeb903ff",
179179 "is_verified": false,
180- "line_number": 63
180+ "line_number": 69
181181 }
182182 ],
183183 "auth_platform/auth_platform_tests/test_password_reset.py": [
199199 }
200200 ]
201201 },
202- "generated_at": "2025-11-17T01:02:39Z "
202+ "generated_at": "2025-11-17T01:05:57Z "
203203}
Original file line number Diff line number Diff line change @@ -38,10 +38,16 @@ def test_register_and_login(client):
3838 }
3939 register = client .post ("/register" , json = register_data )
4040 assert register .status_code == 200
41+ # Registration now auto-enables 2FA
42+ assert "otpauth_uri" in register .json ()
43+ assert register .json ()["requires_2fa_setup" ] is True
4144
45+ # Login now requires 2FA
4246 login = client .post ("/login" , json = {"username" : username , "password" : password })
4347 assert login .status_code == 200
44- assert "access_token" in login .json ()
48+ # Should require 2FA verification
49+ assert "requires2fa" in login .json ()
50+ assert login .json ()["requires2fa" ] is True
4551
4652
4753def test_register_missing_fields (client ):
@@ -71,6 +77,8 @@ def test_login_invalid_password(client):
7177 }
7278 reg = client .post ("/register" , json = register_data )
7379 assert reg .status_code == 200
80+ # Registration now auto-enables 2FA
81+ assert "otpauth_uri" in reg .json ()
7482
7583 # Try to login with wrong password
7684 bad_login = client .post ("/login" , json = {"username" : username , "password" : "wrongpassword" })
You can’t perform that action at this time.
0 commit comments