2023-12-19 22:08:54 +00:00
|
|
|
import aenum
|
|
|
|
|
2024-10-20 17:38:14 +00:00
|
|
|
import socials_util
|
2024-05-12 14:35:17 +00:00
|
|
|
|
2024-03-31 22:37:15 +00:00
|
|
|
|
2023-12-19 22:08:54 +00:00
|
|
|
def test_extension():
|
2024-10-20 17:38:14 +00:00
|
|
|
my_secret_site = aenum.extend_enum(socials_util.SocialSiteId, 'MY_SECRET_SITE', 666)
|
|
|
|
assert my_secret_site
|
|
|
|
assert socials_util.SocialSiteId.MY_SECRET_SITE
|
2023-12-19 22:08:54 +00:00
|
|
|
|
2024-10-20 17:38:14 +00:00
|
|
|
socials_util.REGEXES.append((r'test(\d+)', my_secret_site))
|
2023-12-22 00:19:09 +00:00
|
|
|
|
|
|
|
url = 'test123'
|
2024-10-20 17:38:14 +00:00
|
|
|
result = socials_util.determine_social_from_url(url)
|
2023-12-22 00:19:09 +00:00
|
|
|
assert result is not None
|
2024-10-20 17:38:14 +00:00
|
|
|
assert result.social_site_id == my_secret_site
|
2023-12-22 00:19:09 +00:00
|
|
|
assert result.social_id == '123'
|