diff options
author | mjk <mjk@disroot.org> | 2022-11-12 23:38:59 +0300 |
---|---|---|
committer | mjk <mjk@disroot.org> | 2022-12-08 14:00:56 +0300 |
commit | def536da5aec8724a72ae50728abe33f6b89a4bd (patch) | |
tree | 471d1e2e41e6a5c7a8f61a246cbde33f03bcba3b /test | |
parent | 753e8345539020c30a9aa86c08516c20574dbc12 (diff) |
imprv: Restore ability to manually disambiguate JID-like addresses
...by storing them in `href` attributes as internal-use
`about:ambiguous-address?a@b.c` URIs.
Storing raw `a@b.c` in `href` wouldn't make a lot of semantic sense, as
that's a relative-path URI with the meaning of "the thing named 'a@b.c'
in the same directory as the current document". Plus, it would either
entail handling these addresses outside `parse_uri()`, or changing its
purpose of parsing only absolute URIs.
Diffstat (limited to 'test')
-rw-r--r-- | test/no_gui/test_styling.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/test/no_gui/test_styling.py b/test/no_gui/test_styling.py index 6a4644d0f..1979e6fb6 100644 --- a/test/no_gui/test_styling.py +++ b/test/no_gui/test_styling.py @@ -15,7 +15,7 @@ from gajim.common.styling import EmphasisSpan from gajim.common.styling import StrikeSpan from gajim.common.styling import Hyperlink from gajim.common.styling import process_uris -from gajim.common.text_helpers import jid_to_iri +from gajim.common.text_helpers import escape_iri_query app.settings = MagicMock() @@ -313,6 +313,7 @@ URIS = [ 'file:///x:/foo/bar/baz', # windows 'file://localhost/foo/bar/baz', 'file://nonlocalhost/foo/bar/baz', + 'about:ambiguous-address?a@b.c', # These seem to be from https://mathiasbynens.be/demo/url-regex 'http://foo.com/blah_blah', @@ -437,6 +438,11 @@ UNACCEPTABLE_URIS = [ 'file:a/', 'file:a/b', + 'about:', + 'about:asdfasdf', + 'about:ambiguous-address', + 'about:ambiguous-address?', + 'mailtomailto:foo@bar.com.uk', ] @@ -539,12 +545,12 @@ class Test(unittest.TestCase): self.assertEqual([link.text for link in hlinks], [], text) def test_jids(self): - for jid in JIDS: - text = self.wrap(jid) - uri = jid_to_iri(jid) + for jidlike in JIDS: + text = self.wrap(jidlike) + uri = 'about:ambiguous-address?' + escape_iri_query(jidlike) hlinks = process_uris(text) self.assertEqual([(link.text, link.uri) for link in hlinks], - [(jid, uri)], text) + [(jidlike, uri)], text) def test_nonjids(self): for foo in NONJIDS: |