From dda101b54337def77ed8a260dcaeea2d95788b94 Mon Sep 17 00:00:00 2001 From: Jeffrey Goldberg Date: Sun, 26 Nov 2023 16:56:19 -0600 Subject: [PATCH] unittest --- tests/test_data_model.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_data_model.py b/tests/test_data_model.py index c26b36b..63cdc47 100644 --- a/tests/test_data_model.py +++ b/tests/test_data_model.py @@ -852,3 +852,16 @@ class TestDataModel(unittest.TestCase): with self.subTest(msg="nonexistent file"): with self.assertRaises(FileNotFoundError): 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)