1
0
socials-util/test/test_parsing.py
2024-05-12 16:35:29 +02:00

41 lines
1.8 KiB
Python

import pytest
from socials_util import *
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'),
]
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),
]
@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
assert social_link.social_site_id is not None
@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