This commit is contained in:
Jeffrey Goldberg 2023-11-26 16:56:19 -06:00
parent ac920ab5fe
commit dda101b543
1 changed files with 13 additions and 0 deletions

View File

@ -852,3 +852,16 @@ class TestDataModel(unittest.TestCase):
with self.subTest(msg="nonexistent file"): with self.subTest(msg="nonexistent file"):
with self.assertRaises(FileNotFoundError): with self.assertRaises(FileNotFoundError):
data_model.read_input_file("nonexistent.json") data_model.read_input_file("nonexistent.json")
def test_mastodon_parsing(self):
mastodon_name = 'jpgoldberg@ioc.exchange'
expected = "https://ioc.exchange/@jpgoldberg"
result = data_model.Connection.MastodonUname2Url(mastodon_name)
with self.subTest("Without '@' prefix"):
self.assertEqual(result, expected)
mastodon_name = '@jpgoldberg@ioc.exchange'
expected = "https://ioc.exchange/@jpgoldberg"
result = data_model.Connection.MastodonUname2Url(mastodon_name)
with self.subTest("With '@' prefix"):
self.assertEqual(result, expected)