ids.translate_handle: test AP => ATProto error for leading/trailing dash

pull/1241/head
Ryan Barrett 2024-08-06 14:41:31 -07:00
rodzic c4f75bfbd0
commit a49fa0d5e0
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
1 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -170,10 +170,15 @@ class IdsTest(TestCase):
(Web, 'bsky.brid.gy', ActivityPub, '@bsky.brid.gy@bsky.brid.gy'),
(Web, 'ap.brid.gy', ATProto, 'ap.brid.gy'),
]:
with self.subTest(from_=from_.LABEL, to=to.LABEL):
with self.subTest(from_=from_.LABEL, handle=handle, to=to.LABEL):
self.assertEqual(expected, translate_handle(
handle=handle, from_=from_, to=to, enhanced=False))
for input in '@_user@instance', '@user~@instance':
with self.subTest(input=input), self.assertRaises(ValueError):
translate_handle(handle=input, from_=ActivityPub, to=ATProto,
enhanced=False)
def test_translate_handle_enhanced(self):
for from_, handle, to, expected in [
(Web, 'user.com', ActivityPub, '@user.com@user.com'),