1
0

Param tests
All checks were successful
Python Package / Package (push) Successful in 19s

This commit is contained in:
Jon Michael Aanes 2024-04-01 00:50:52 +02:00
parent c4f320b251
commit f73ba5ccc2
Signed by: Jmaa
SSH Key Fingerprint: SHA256:Ab0GfHGCblESJx7JRE4fj4bFy/KRpeLhi41y4pF3sNA

View File

@ -1,69 +1,40 @@
from socials_util import * from socials_util import *
import pytest
def test_parsing(): PARSABLE_SOCIAL_IDS = [
assert determine_social_from_url('http://www.twitter.com/dril').social_id == 'dril' ('http://www.twitter.com/dril', 'dril'),
assert determine_social_from_url('http://worstdril.tumblr.com/') ('http://worstdril.tumblr.com/', 'worstdril'),
assert ( ('https://deep-dark-fears.tumblr.com', 'deep-dark-fears'),
determine_social_from_url('https://deep-dark-fears.tumblr.com').social_id ('https://www.etsy.com/shop/aleksiremesart', 'aleksiremesart'),
== 'deep-dark-fears' ('https://ko-fi.com/A627LI1/shop', 'A627LI1'),
) ('https://ko-fi.com/A627LI1/', 'A627LI1'),
assert ( ('https://www.facebook.com/fredagscafeen.dk/', 'fredagscafeen.dk'),
determine_social_from_url('https://www.etsy.com/shop/aleksiremesart').social_id ('https://www.tiktok.com/@depthsofwikipedia?lang=en', 'depthsofwikipedia'),
== 'aleksiremesart' ('https://www.pixiv.net/users/14866303', '14866303'),
) ('https://www.pixiv.net/member.php?id=109710', '109710'),
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
)
INSTAGRAMS = [ PARSABLE_SOCIAL_SITE_IDS = [
'https://instagram.com/_richardparry_', ('https://www.deviantart.com/solquiet', SocialSiteId.DEVIANT_ART_ACCOUNT),
'https://instagram.com/j_kmor/', ('https://solquiet.deviantart.com/', SocialSiteId.DEVIANT_ART_ACCOUNT),
'https://instagram.com/cullensartbox/', ('https://cohost.org/example', SocialSiteId.COHOST_PROFILE),
'https://www.instagram.com/timkongart/', ('https://instagram.com/_richardparry_', SocialSiteId.INSTAGRAM_PAGE),
'https://www.instagram.com/kcn.wu/', ('https://instagram.com/j_kmor/', SocialSiteId.INSTAGRAM_PAGE),
'https://www.instagram.com/itsbettyjiang', ('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),
]
for ig in INSTAGRAMS:
assert ( @pytest.mark.parametrize('url,expected_social_id', PARSABLE_SOCIAL_IDS)
determine_social_from_url(ig).social_site_id == SocialSiteId.INSTAGRAM_PAGE 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