from services.credit_html_identity_service import CreditHtmlIdentityService


def test_extract_identity_should_read_generated_html_meta_fields():
    service = CreditHtmlIdentityService()
    html = """
    <html>
      <head>
        <meta name="ccdi-staff-name" content="王五" />
        <meta name="ccdi-staff-id-card" content="330101198801010011" />
      </head>
      <body></body>
    </html>
    """

    identity = service.extract_identity(html)

    assert identity["staff_name"] == "王五"
    assert identity["staff_id_card"] == "330101198801010011"
