1
0
socials-util/test/test_extension.py
Jon Michael Aanes 1cda90c0bc
All checks were successful
Python Ruff Code Quality / ruff (push) Successful in 22s
Run Python tests (through Pytest) / Test (push) Successful in 25s
Verify Python project can be installed, loaded and have version checked / Test (push) Successful in 22s
Fixed tests
2024-11-01 21:45:28 +01:00

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'