Fix basedpyright type errors (#25435)
Signed-off-by: -LAN- <laipz8200@outlook.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1370,8 +1370,8 @@ class TestRegisterService:
|
||||
account_id="user-123", email="test@example.com"
|
||||
)
|
||||
|
||||
with patch("services.account_service.RegisterService._get_invitation_by_token") as mock_get_invitation_by_token:
|
||||
# Mock the invitation data returned by _get_invitation_by_token
|
||||
with patch("services.account_service.RegisterService.get_invitation_by_token") as mock_get_invitation_by_token:
|
||||
# Mock the invitation data returned by get_invitation_by_token
|
||||
invitation_data = {
|
||||
"account_id": "user-123",
|
||||
"email": "test@example.com",
|
||||
@@ -1503,12 +1503,12 @@ class TestRegisterService:
|
||||
assert result == "member_invite:token:test-token"
|
||||
|
||||
def test_get_invitation_by_token_with_workspace_and_email(self, mock_redis_dependencies):
|
||||
"""Test _get_invitation_by_token with workspace ID and email."""
|
||||
"""Test get_invitation_by_token with workspace ID and email."""
|
||||
# Setup mock
|
||||
mock_redis_dependencies.get.return_value = b"user-123"
|
||||
|
||||
# Execute test
|
||||
result = RegisterService._get_invitation_by_token("token-123", "workspace-456", "test@example.com")
|
||||
result = RegisterService.get_invitation_by_token("token-123", "workspace-456", "test@example.com")
|
||||
|
||||
# Verify results
|
||||
assert result is not None
|
||||
@@ -1517,7 +1517,7 @@ class TestRegisterService:
|
||||
assert result["workspace_id"] == "workspace-456"
|
||||
|
||||
def test_get_invitation_by_token_without_workspace_and_email(self, mock_redis_dependencies):
|
||||
"""Test _get_invitation_by_token without workspace ID and email."""
|
||||
"""Test get_invitation_by_token without workspace ID and email."""
|
||||
# Setup mock
|
||||
invitation_data = {
|
||||
"account_id": "user-123",
|
||||
@@ -1527,19 +1527,19 @@ class TestRegisterService:
|
||||
mock_redis_dependencies.get.return_value = json.dumps(invitation_data).encode()
|
||||
|
||||
# Execute test
|
||||
result = RegisterService._get_invitation_by_token("token-123")
|
||||
result = RegisterService.get_invitation_by_token("token-123")
|
||||
|
||||
# Verify results
|
||||
assert result is not None
|
||||
assert result == invitation_data
|
||||
|
||||
def test_get_invitation_by_token_no_data(self, mock_redis_dependencies):
|
||||
"""Test _get_invitation_by_token with no data."""
|
||||
"""Test get_invitation_by_token with no data."""
|
||||
# Setup mock
|
||||
mock_redis_dependencies.get.return_value = None
|
||||
|
||||
# Execute test
|
||||
result = RegisterService._get_invitation_by_token("token-123")
|
||||
result = RegisterService.get_invitation_by_token("token-123")
|
||||
|
||||
# Verify results
|
||||
assert result is None
|
||||
|
||||
Reference in New Issue
Block a user