@@ -19,77 +19,80 @@ def simple_query(sites_info: dict, site: str, username: str) -> QueryStatus:
19
19
)[site ]['status' ].status
20
20
21
21
22
- # Known positives should only use sites trusted to be reliable and unchanging
23
- @pytest .mark .parametrize ('site,username' ,[
24
- ('GitLab' , 'ppfeister' ),
25
- ('AllMyLinks' , 'blue' ),
26
- ])
27
- def test_known_positives_via_message (sites_info , site , username ):
28
- assert simple_query (sites_info = sites_info , site = site , username = username ) is QueryStatus .CLAIMED
22
+ @pytest .mark .online
23
+ class TestLiveTargets :
24
+ """Actively test probes against live and trusted targets"""
25
+ # Known positives should only use sites trusted to be reliable and unchanging
26
+ @pytest .mark .parametrize ('site,username' ,[
27
+ ('GitLab' , 'ppfeister' ),
28
+ ('AllMyLinks' , 'blue' ),
29
+ ])
30
+ def test_known_positives_via_message (self , sites_info , site , username ):
31
+ assert simple_query (sites_info = sites_info , site = site , username = username ) is QueryStatus .CLAIMED
29
32
30
33
31
- # Known positives should only use sites trusted to be reliable and unchanging
32
- @pytest .mark .parametrize ('site,username' ,[
33
- ('GitHub' , 'ppfeister' ),
34
- ('GitHub' , 'sherlock-project' ),
35
- ('Docker Hub' , 'ppfeister' ),
36
- ('Docker Hub' , 'sherlock' ),
37
- ])
38
- def test_known_positives_via_status_code (sites_info , site , username ):
39
- assert simple_query (sites_info = sites_info , site = site , username = username ) is QueryStatus .CLAIMED
34
+ # Known positives should only use sites trusted to be reliable and unchanging
35
+ @pytest .mark .parametrize ('site,username' ,[
36
+ ('GitHub' , 'ppfeister' ),
37
+ ('GitHub' , 'sherlock-project' ),
38
+ ('Docker Hub' , 'ppfeister' ),
39
+ ('Docker Hub' , 'sherlock' ),
40
+ ])
41
+ def test_known_positives_via_status_code (self , sites_info , site , username ):
42
+ assert simple_query (sites_info = sites_info , site = site , username = username ) is QueryStatus .CLAIMED
40
43
41
44
42
- # Known positives should only use sites trusted to be reliable and unchanging
43
- @pytest .mark .parametrize ('site,username' ,[
44
- ('BodyBuilding' , 'blue' ),
45
- ('labpentestit' , 'CSV' ),
46
- ])
47
- def test_known_positives_via_response_url (sites_info , site , username ):
48
- assert simple_query (sites_info = sites_info , site = site , username = username ) is QueryStatus .CLAIMED
45
+ # Known positives should only use sites trusted to be reliable and unchanging
46
+ @pytest .mark .parametrize ('site,username' ,[
47
+ ('BodyBuilding' , 'blue' ),
48
+ ('labpentestit' , 'CSV' ),
49
+ ])
50
+ def test_known_positives_via_response_url (self , sites_info , site , username ):
51
+ assert simple_query (sites_info = sites_info , site = site , username = username ) is QueryStatus .CLAIMED
49
52
50
53
51
- # Randomly generate usernames of high length and test for positive availability
52
- # Randomly generated usernames should be simple alnum for simplicity and high
53
- # compatibility. Several attempts may be made ~just in case~ a real username is
54
- # generated.
55
- @pytest .mark .parametrize ('site,random_len' ,[
56
- ('GitLab' , 255 ),
57
- ('Codecademy' , 30 )
58
- ])
59
- def test_likely_negatives_via_message (sites_info , site , random_len ):
60
- num_attempts : int = 3
61
- attempted_usernames : list [str ] = []
62
- status : QueryStatus = QueryStatus .CLAIMED
63
- for i in range (num_attempts ):
64
- acceptable_types = string .ascii_letters + string .digits
65
- random_handle = '' .join (random .choice (acceptable_types ) for _ in range (random_len ))
66
- attempted_usernames .append (random_handle )
67
- status = simple_query (sites_info = sites_info , site = site , username = random_handle )
68
- if status is QueryStatus .AVAILABLE :
69
- break
70
- assert status is QueryStatus .AVAILABLE , f"Could not validate available username after { num_attempts } attempts with randomly generated usernames { attempted_usernames } ."
54
+ # Randomly generate usernames of high length and test for positive availability
55
+ # Randomly generated usernames should be simple alnum for simplicity and high
56
+ # compatibility. Several attempts may be made ~just in case~ a real username is
57
+ # generated.
58
+ @pytest .mark .parametrize ('site,random_len' ,[
59
+ ('GitLab' , 255 ),
60
+ ('Codecademy' , 30 )
61
+ ])
62
+ def test_likely_negatives_via_message (self , sites_info , site , random_len ):
63
+ num_attempts : int = 3
64
+ attempted_usernames : list [str ] = []
65
+ status : QueryStatus = QueryStatus .CLAIMED
66
+ for i in range (num_attempts ):
67
+ acceptable_types = string .ascii_letters + string .digits
68
+ random_handle = '' .join (random .choice (acceptable_types ) for _ in range (random_len ))
69
+ attempted_usernames .append (random_handle )
70
+ status = simple_query (sites_info = sites_info , site = site , username = random_handle )
71
+ if status is QueryStatus .AVAILABLE :
72
+ break
73
+ assert status is QueryStatus .AVAILABLE , f"Could not validate available username after { num_attempts } attempts with randomly generated usernames { attempted_usernames } ."
71
74
72
75
73
- # Randomly generate usernames of high length and test for positive availability
74
- # Randomly generated usernames should be simple alnum for simplicity and high
75
- # compatibility. Several attempts may be made ~just in case~ a real username is
76
- # generated.
77
- @pytest .mark .parametrize ('site,random_len' ,[
78
- ('GitHub' , 39 ),
79
- ('Docker Hub' , 30 )
80
- ])
81
- def test_likely_negatives_via_status_code (sites_info , site , random_len ):
82
- num_attempts : int = 3
83
- attempted_usernames : list [str ] = []
84
- status : QueryStatus = QueryStatus .CLAIMED
85
- for i in range (num_attempts ):
86
- acceptable_types = string .ascii_letters + string .digits
87
- random_handle = '' .join (random .choice (acceptable_types ) for _ in range (random_len ))
88
- attempted_usernames .append (random_handle )
89
- status = simple_query (sites_info = sites_info , site = site , username = random_handle )
90
- if status is QueryStatus .AVAILABLE :
91
- break
92
- assert status is QueryStatus .AVAILABLE , f"Could not validate available username after { num_attempts } attempts with randomly generated usernames { attempted_usernames } ."
76
+ # Randomly generate usernames of high length and test for positive availability
77
+ # Randomly generated usernames should be simple alnum for simplicity and high
78
+ # compatibility. Several attempts may be made ~just in case~ a real username is
79
+ # generated.
80
+ @pytest .mark .parametrize ('site,random_len' ,[
81
+ ('GitHub' , 39 ),
82
+ ('Docker Hub' , 30 )
83
+ ])
84
+ def test_likely_negatives_via_status_code (self , sites_info , site , random_len ):
85
+ num_attempts : int = 3
86
+ attempted_usernames : list [str ] = []
87
+ status : QueryStatus = QueryStatus .CLAIMED
88
+ for i in range (num_attempts ):
89
+ acceptable_types = string .ascii_letters + string .digits
90
+ random_handle = '' .join (random .choice (acceptable_types ) for _ in range (random_len ))
91
+ attempted_usernames .append (random_handle )
92
+ status = simple_query (sites_info = sites_info , site = site , username = random_handle )
93
+ if status is QueryStatus .AVAILABLE :
94
+ break
95
+ assert status is QueryStatus .AVAILABLE , f"Could not validate available username after { num_attempts } attempts with randomly generated usernames { attempted_usernames } ."
93
96
94
97
95
98
def test_username_illegal_regex (sites_info ):
0 commit comments