import pytest from socials_util import * PARSABLE_SOCIAL_IDS_COMBINED = [ # Tumblr formats ('https://triviallytrue.tumblr.com/', SocialSiteId.TUMBLR, 'triviallytrue'), ('https://tumblr.com/triviallytrue', SocialSiteId.TUMBLR, 'triviallytrue'), ('https://tumblr.com/blog/triviallytrue', SocialSiteId.TUMBLR, 'triviallytrue'), ( 'https://tumblr.com/blog/view/triviallytrue', SocialSiteId.TUMBLR, 'triviallytrue', ), ('https://www.tumblr.com/triviallytrue', SocialSiteId.TUMBLR, 'triviallytrue'), ('https://www.tumblr.com/blog/triviallytrue', SocialSiteId.TUMBLR, 'triviallytrue'), ( 'https://www.tumblr.com/blog/view/triviallytrue', SocialSiteId.TUMBLR, 'triviallytrue', ), ] PARSABLE_SOCIAL_IDS = [ ('http://www.twitter.com/dril', 'dril'), ('http://worstdril.tumblr.com/', 'worstdril'), ('https://deep-dark-fears.tumblr.com', 'deep-dark-fears'), ('https://www.etsy.com/shop/aleksiremesart', 'aleksiremesart'), ('https://ko-fi.com/A627LI1/shop', 'A627LI1'), ('https://ko-fi.com/A627LI1/', 'A627LI1'), ('https://www.facebook.com/fredagscafeen.dk/', 'fredagscafeen.dk'), ('https://www.tiktok.com/@depthsofwikipedia?lang=en', 'depthsofwikipedia'), ('https://www.pixiv.net/users/14866303', '14866303'), ('https://www.pixiv.net/member.php?id=109710', '109710'), ] + [(a, c) for (a, b, c) in PARSABLE_SOCIAL_IDS_COMBINED] PARSABLE_SOCIAL_SITE_IDS = [ ('https://www.deviantart.com/solquiet', SocialSiteId.DEVIANT_ART_ACCOUNT), ('https://solquiet.deviantart.com/', SocialSiteId.DEVIANT_ART_ACCOUNT), ('https://cohost.org/example', SocialSiteId.COHOST_PROFILE), ('https://instagram.com/_richardparry_', SocialSiteId.INSTAGRAM_PAGE), ('https://instagram.com/j_kmor/', SocialSiteId.INSTAGRAM_PAGE), ('https://instagram.com/cullensartbox/', SocialSiteId.INSTAGRAM_PAGE), ('https://www.instagram.com/timkongart/', SocialSiteId.INSTAGRAM_PAGE), ('https://www.instagram.com/kcn.wu/', SocialSiteId.INSTAGRAM_PAGE), ('https://www.instagram.com/itsbettyjiang', SocialSiteId.INSTAGRAM_PAGE), ] + [(a, b) for (a, b, c) in PARSABLE_SOCIAL_IDS_COMBINED] @pytest.mark.parametrize('url,expected_social_id', PARSABLE_SOCIAL_IDS) def test_parse_social_ids(url, expected_social_id): social_link = determine_social_from_url(url) assert social_link.social_id == expected_social_id, url assert social_link.social_site_id is not None, url @pytest.mark.parametrize('url,expected_social_site_id', PARSABLE_SOCIAL_SITE_IDS) def test_parse_social_site_ids(url, expected_social_site_id): assert determine_social_from_url(url).social_site_id == expected_social_site_id, url