-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_extract_socials_negative.py
More file actions
81 lines (72 loc) · 1.9 KB
/
test_extract_socials_negative.py
File metadata and controls
81 lines (72 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import pytest
from src.models.europython import EuroPythonSpeaker
# === Mastodon ===
@pytest.mark.parametrize(
("input_string",),
[
("",),
("false",),
("mastodon@",),
("@user@",),
("username@",),
("https://mastodon.social/user",),
("mastodon.social/user",),
("@mastodon.social",),
("https://hostux.social/users/username",),
("https://social/@",),
],
)
def test_mastodon_url_invalid(input_string):
assert EuroPythonSpeaker.extract_mastodon_url(input_string) is None
# === LinkedIn ===
@pytest.mark.parametrize(
("input_string",),
[
("",),
("/in/",),
("linkedin.com/in/",),
("linkedin.com/in",),
("linkedin.com/username",),
("linkedin.net/in/username",),
("http://linkedin.com/user",),
("http://",),
("n/a",),
],
)
def test_linkedin_url_invalid(input_string):
assert EuroPythonSpeaker.extract_linkedin_url(input_string) is None
# === Twitter / X ===
@pytest.mark.parametrize(
("input_string",),
[
("",),
("-",),
("user-name",),
("x.com/",),
("https://x.com/",),
("https://twitter.com/",),
("http://",),
("@user@",),
("user!",),
("too_long_username_123",),
("twitter.com/user-with-hyphen",),
("https://github.com/user",),
],
)
def test_twitter_url_invalid(input_string):
assert EuroPythonSpeaker.extract_twitter_url(input_string) is None
# === GitHub / GitLab ===
@pytest.mark.parametrize(
("input_string",),
[
("",),
("https://bitbucket.org/user",),
("bitbucket.org/user",),
("codeberg.org/user",),
("https://git.example.com/user",),
("http://",),
("@/",),
],
)
def test_gitx_url_invalid(input_string):
assert EuroPythonSpeaker.extract_gitx_url(input_string) is None