from fastapi import status
from fastapi.testclient import TestClient


class TestUserGet:
    PATH = "/v1/users"

    def test_returns_user(
        self,
        test_client: TestClient,
        registered_identifiers: dict[str, str],
    ) -> None:
        """認証テナントに紐づくユーザー詳細を取得できることを確認する。"""
        user_id = registered_identifiers["user_alpha_member_id"]

        response = test_client.get(url=f"{self.PATH}/{user_id}")

        assert response.status_code == status.HTTP_200_OK
        assert response.json() == {
            "id": user_id,
            "display_id": "0001",
            "display_name": "社員001#アルファ株式会社",
            "email": "test001@test.com",
        }

    def test_user_not_found(
        self,
        test_client: TestClient,
        registered_identifiers: dict[str, str],
    ) -> None:
        """認証テナントに紐づかないユーザー詳細の取得リクエストを拒否できることを確認する。"""
        response = test_client.get(url=f"{self.PATH}/{registered_identifiers['user_beta_member_id']}")

        assert response.status_code == status.HTTP_404_NOT_FOUND
        assert response.json() == {
            "detail": "Requested resource was not found.",
            "invalid_parameters": None,
        }
