Merge pull request #162 from TheYahya/hoadlck-test-speedup

Tests Speedup
pull/161/head
Christopher Kent Hoadley 6 years ago committed by GitHub
commit febcb0718d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -91,7 +91,9 @@
"errorType": "status_code", "errorType": "status_code",
"rank": 839, "rank": 839,
"url": "https://bitbucket.org/{}", "url": "https://bitbucket.org/{}",
"urlMain": "https://bitbucket.org/" "urlMain": "https://bitbucket.org/",
"username_claimed": "blue",
"username_unclaimed": "noonewouldeverusethis7"
}, },
"BlackPlanet": { "BlackPlanet": {
"errorMsg": "My Hits", "errorMsg": "My Hits",
@ -807,20 +809,25 @@
"errorType": "status_code", "errorType": "status_code",
"rank": 3373, "rank": 3373,
"url": "https://vsco.co/{}", "url": "https://vsco.co/{}",
"urlMain": "https://vsco.co/" "urlMain": "https://vsco.co/",
"username_claimed": "blue",
"username_unclaimed": "noonewouldeverusethis7"
}, },
"Venmo": { "Venmo": {
"errorType": "status_code", "errorType": "status_code",
"rank": 4868, "rank": 4868,
"url": "https://venmo.com/{}", "url": "https://venmo.com/{}",
"urlMain": "https://venmo.com/" "urlMain": "https://venmo.com/",
"username_claimed": "jenny",
"username_unclaimed": "noonewouldeverusethis7"
}, },
"Vimeo": { "Vimeo": {
"errorMsg": "404 Not Found", "errorType": "status_code",
"errorType": "message",
"rank": 139, "rank": 139,
"url": "https://vimeo.com/{}", "url": "https://vimeo.com/{}",
"urlMain": "https://vimeo.com/" "urlMain": "https://vimeo.com/",
"username_claimed": "blue",
"username_unclaimed": "noonewouldeverusethis7"
}, },
"VirusTotal": { "VirusTotal": {
"errorMsg": "not found", "errorMsg": "not found",
@ -883,8 +890,10 @@
"YouPic": { "YouPic": {
"errorType": "status_code", "errorType": "status_code",
"rank": 41827, "rank": 41827,
"url": "https://youpic.com/photographer/{}", "url": "https://youpic.com/photographer/{}/",
"urlMain": "https://youpic.com/" "urlMain": "https://youpic.com/",
"username_claimed": "blue",
"username_unclaimed": "noonewouldeverusethis7"
}, },
"YouTube": { "YouTube": {
"errorMsg": "Not Found", "errorMsg": "Not Found",

@ -128,6 +128,10 @@ class SherlockBaseTest(unittest.TestCase):
existence state. existence state.
""" """
#Dictionary of sites that should be tested for having a username.
#This will allow us to test sites with a common username in parallel.
sites_by_username = {}
for site, site_data in self.site_data_all.items(): for site, site_data in self.site_data_all.items():
if ( if (
(site_data["errorType"] != detect_type) or (site_data["errorType"] != detect_type) or
@ -143,12 +147,22 @@ class SherlockBaseTest(unittest.TestCase):
# Figure out which type of user # Figure out which type of user
if exist_check: if exist_check:
username_list = [site_data.get("username_claimed")] username = site_data.get("username_claimed")
else:
username = site_data.get("username_unclaimed")
# Add this site to the list of sites corresponding to this
# username.
if username in sites_by_username:
sites_by_username[username].append(site)
else: else:
username_list = [site_data.get("username_unclaimed")] sites_by_username[username] = [site]
self.username_check(username_list,
[site], # Check on the username availability against all of the sites.
exist_check=exist_check for username, site_list in sites_by_username.items():
) self.username_check([username],
site_list,
exist_check=exist_check
)
return return

Loading…
Cancel
Save