mirror of
				https://github.com/fastapi-users/fastapi-users.git
				synced 2025-10-31 17:38:30 +08:00 
			
		
		
		
	Drop Python 3.8 support
This commit is contained in:
		| @ -1,4 +1,5 @@ | ||||
| from typing import Any, AsyncGenerator, Dict, cast | ||||
| from collections.abc import AsyncGenerator | ||||
| from typing import Any, cast | ||||
|  | ||||
| import httpx | ||||
| import pytest | ||||
| @ -52,7 +53,7 @@ class TestRegister: | ||||
|         json = {"email": "king.arthur@camelot.bt", "password": "g"} | ||||
|         response = await test_app_client.post("/register", json=json) | ||||
|         assert response.status_code == status.HTTP_400_BAD_REQUEST | ||||
|         data = cast(Dict[str, Any], response.json()) | ||||
|         data = cast(dict[str, Any], response.json()) | ||||
|         assert data["detail"] == { | ||||
|             "code": ErrorCode.REGISTER_INVALID_PASSWORD, | ||||
|             "reason": "Password should be at least 3 characters", | ||||
| @ -65,7 +66,7 @@ class TestRegister: | ||||
|         json = {"email": email, "password": "guinevere"} | ||||
|         response = await test_app_client.post("/register", json=json) | ||||
|         assert response.status_code == status.HTTP_400_BAD_REQUEST | ||||
|         data = cast(Dict[str, Any], response.json()) | ||||
|         data = cast(dict[str, Any], response.json()) | ||||
|         assert data["detail"] == ErrorCode.REGISTER_USER_ALREADY_EXISTS | ||||
|  | ||||
|     @pytest.mark.parametrize("email", ["lancelot@camelot.bt", "Lancelot@camelot.bt"]) | ||||
| @ -74,7 +75,7 @@ class TestRegister: | ||||
|         response = await test_app_client.post("/register", json=json) | ||||
|         assert response.status_code == status.HTTP_201_CREATED | ||||
|  | ||||
|         data = cast(Dict[str, Any], response.json()) | ||||
|         data = cast(dict[str, Any], response.json()) | ||||
|         assert "hashed_password" not in data | ||||
|         assert "password" not in data | ||||
|         assert data["id"] is not None | ||||
| @ -88,7 +89,7 @@ class TestRegister: | ||||
|         response = await test_app_client.post("/register", json=json) | ||||
|         assert response.status_code == status.HTTP_201_CREATED | ||||
|  | ||||
|         data = cast(Dict[str, Any], response.json()) | ||||
|         data = cast(dict[str, Any], response.json()) | ||||
|         assert data["is_superuser"] is False | ||||
|  | ||||
|     async def test_valid_body_is_active(self, test_app_client: httpx.AsyncClient): | ||||
| @ -100,7 +101,7 @@ class TestRegister: | ||||
|         response = await test_app_client.post("/register", json=json) | ||||
|         assert response.status_code == status.HTTP_201_CREATED | ||||
|  | ||||
|         data = cast(Dict[str, Any], response.json()) | ||||
|         data = cast(dict[str, Any], response.json()) | ||||
|         assert data["is_active"] is True | ||||
|  | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 François Voron
					François Voron