1
0
socials-util/test/test_parsing.py

70 lines
2.1 KiB
Python
Raw Normal View History

2023-12-16 22:09:27 +00:00
from socials_util import *
2024-03-31 22:37:15 +00:00
2023-12-16 22:09:27 +00:00
def test_parsing():
assert determine_social_from_url('http://www.twitter.com/dril').social_id == 'dril'
assert determine_social_from_url('http://worstdril.tumblr.com/')
2024-03-31 22:37:15 +00:00
assert (
determine_social_from_url('https://deep-dark-fears.tumblr.com').social_id
== 'deep-dark-fears'
)
assert (
determine_social_from_url('https://www.etsy.com/shop/aleksiremesart').social_id
== 'aleksiremesart'
)
assert (
determine_social_from_url('https://ko-fi.com/A627LI1/shop').social_id
== 'A627LI1'
)
assert (
determine_social_from_url('https://ko-fi.com/A627LI1/').social_id == 'A627LI1'
)
assert (
determine_social_from_url(
'https://www.facebook.com/fredagscafeen.dk/'
).social_id
== 'fredagscafeen.dk'
)
assert (
determine_social_from_url(
'https://www.tiktok.com/@depthsofwikipedia?lang=en'
).social_id
== 'depthsofwikipedia'
)
assert (
determine_social_from_url('https://www.pixiv.net/users/14866303').social_id
== '14866303'
)
assert (
determine_social_from_url(
'https://www.pixiv.net/member.php?id=109710'
).social_id
== '109710'
)
assert (
determine_social_from_url('https://www.deviantart.com/solquiet').social_site_id
== SocialSiteId.DEVIANT_ART_ACCOUNT
)
assert (
determine_social_from_url('https://solquiet.deviantart.com/').social_site_id
== SocialSiteId.DEVIANT_ART_ACCOUNT
)
assert (
determine_social_from_url('https://cohost.org/example').social_site_id
== SocialSiteId.COHOST_PROFILE
)
2023-12-16 22:09:27 +00:00
INSTAGRAMS = [
'https://instagram.com/_richardparry_',
'https://instagram.com/j_kmor/',
'https://instagram.com/cullensartbox/',
'https://www.instagram.com/timkongart/',
'https://www.instagram.com/kcn.wu/',
'https://www.instagram.com/itsbettyjiang',
]
for ig in INSTAGRAMS:
2024-03-31 22:37:15 +00:00
assert (
determine_social_from_url(ig).social_site_id == SocialSiteId.INSTAGRAM_PAGE
)