from juris_base.utils.aspnet import extract_tokens

SAMPLE_HTML = """
<input type="hidden" id="__VIEWSTATE" value="abc123" />
<input type="hidden" id="__VIEWSTATEGENERATOR" value="CAFE" />
<input type="hidden" id="__EVENTVALIDATION" value="xyz789" />
"""


def test_extracts_all_tokens():
    tokens = extract_tokens(SAMPLE_HTML)
    assert tokens["__VIEWSTATE"] == "abc123"
    assert tokens["__VIEWSTATEGENERATOR"] == "CAFE"
    assert tokens["__EVENTVALIDATION"] == "xyz789"


def test_missing_token_not_in_result():
    tokens = extract_tokens("<input id='__VIEWSTATE' value='x' />")
    assert "__VIEWSTATE" in tokens
    assert "__EVENTVALIDATION" not in tokens
