You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
832 B
21 lines
832 B
"""NIP-05 identifier collection and parsing.""" |
|
|
|
from imwald.core.kind0_profile import collect_nip05_identifiers |
|
from imwald.core.nip05 import parse_nip05_identifier |
|
|
|
|
|
def test_parse_nip05_identifier() -> None: |
|
assert parse_nip05_identifier("bob@Example.com") == ("bob", "example.com") |
|
assert parse_nip05_identifier("not an id") is None |
|
|
|
|
|
def test_collect_from_json_and_tags_and_scan() -> None: |
|
content = '{"name":"x","nip05":"a@b.co"} extra@scan.org tail' |
|
tags: list[list[str]] = [["nip05", "c@d.co"], ["nip-05", "e@f.co"], ["client", "x"]] |
|
got = collect_nip05_identifiers(content, tags) |
|
assert got == ["a@b.co", "c@d.co", "e@f.co", "extra@scan.org"] |
|
|
|
|
|
def test_collect_dedupes() -> None: |
|
content = '{"nip05":"Same@X.org"} same@x.org' |
|
assert collect_nip05_identifiers(content, []) == ["Same@X.org"]
|
|
|