24 lines
671 B
Python
24 lines
671 B
Python
import aenum
|
|
import pytest
|
|
|
|
import socials_util
|
|
|
|
|
|
def test_re_social_path_validation():
|
|
with pytest.raises(ValueError, match='Redundant www: www.example.org'):
|
|
socials_util.re_social_path('www.example.org')
|
|
|
|
|
|
def test_extension():
|
|
my_secret_site = aenum.extend_enum(socials_util.SocialSiteId, 'MY_SECRET_SITE', 666)
|
|
assert my_secret_site
|
|
assert socials_util.SocialSiteId.MY_SECRET_SITE
|
|
|
|
socials_util.REGEXES.append((r'test(\d+)', my_secret_site))
|
|
|
|
url = 'test123'
|
|
result = socials_util.determine_social_from_url(url)
|
|
assert result is not None
|
|
assert result.social_site_id == my_secret_site
|
|
assert result.social_id == '123'
|