1
0
socials-util/test/test_extension.py

23 lines
630 B
Python

import pytest
import aenum
import socials_util
def test_re_social_path_validation():
with pytest.raises(ValueError):
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'