From dea8c293510626181907d802336bedfd78585b4e Mon Sep 17 00:00:00 2001 From: "Christopher K. Hoadley" Date: Sun, 3 Feb 2019 11:14:45 -0600 Subject: [PATCH 1/6] Change tests so that all sites that share a common username are executed in parallel. Just the little bit of extra processing halves the time taken for the tests (~15s verus ~34s). This will only get worse as the test coverage improves... --- tests/base.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/tests/base.py b/tests/base.py index e17d8c8d..e3b18970 100644 --- a/tests/base.py +++ b/tests/base.py @@ -128,6 +128,10 @@ class SherlockBaseTest(unittest.TestCase): 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(): if ( (site_data["errorType"] != detect_type) or @@ -143,12 +147,22 @@ class SherlockBaseTest(unittest.TestCase): # Figure out which type of user 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: - username_list = [site_data.get("username_unclaimed")] - self.username_check(username_list, - [site], - exist_check=exist_check - ) + sites_by_username[username] = [site] + + # Check on the username availability against all of the sites. + for username, site_list in sites_by_username.items(): + self.username_check([username], + site_list, + exist_check=exist_check + ) return From bc6bc0a8f15b63110aeae5b29861b0de068fda9e Mon Sep 17 00:00:00 2001 From: "Christopher K. Hoadley" Date: Sun, 3 Feb 2019 11:18:33 -0600 Subject: [PATCH 2/6] Add BitBucket to tests. --- data.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data.json b/data.json index 7081f74b..bcd31aa2 100644 --- a/data.json +++ b/data.json @@ -91,7 +91,9 @@ "errorType": "status_code", "rank": 839, "url": "https://bitbucket.org/{}", - "urlMain": "https://bitbucket.org/" + "urlMain": "https://bitbucket.org/", + "username_claimed": "blue", + "username_unclaimed": "noonewouldeverusethis7" }, "BlackPlanet": { "errorMsg": "My Hits", From 5bc6261a9029599613644967d9d1c495dd4bd275 Mon Sep 17 00:00:00 2001 From: "Christopher K. Hoadley" Date: Sun, 3 Feb 2019 11:20:05 -0600 Subject: [PATCH 3/6] Fix YouPic detection. It was saying that usernames where available which were taken. Add to tests. --- data.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/data.json b/data.json index bcd31aa2..ca7cb083 100644 --- a/data.json +++ b/data.json @@ -885,8 +885,10 @@ "YouPic": { "errorType": "status_code", "rank": 41827, - "url": "https://youpic.com/photographer/{}", - "urlMain": "https://youpic.com/" + "url": "https://youpic.com/photographer/{}/", + "urlMain": "https://youpic.com/", + "username_claimed": "blue", + "username_unclaimed": "noonewouldeverusethis7" }, "YouTube": { "errorMsg": "Not Found", From 8c401b1a7b9284cfd17ba1f715380d0a9a7758d6 Mon Sep 17 00:00:00 2001 From: "Christopher K. Hoadley" Date: Sun, 3 Feb 2019 11:46:28 -0600 Subject: [PATCH 4/6] Add Venmo to tests. --- data.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data.json b/data.json index ca7cb083..21c0f43a 100644 --- a/data.json +++ b/data.json @@ -815,7 +815,9 @@ "errorType": "status_code", "rank": 4868, "url": "https://venmo.com/{}", - "urlMain": "https://venmo.com/" + "urlMain": "https://venmo.com/", + "username_claimed": "jenny", + "username_unclaimed": "noonewouldeverusethis7" }, "Vimeo": { "errorMsg": "404 Not Found", From dfddfbc8382d3109c2ef749b73ba365bba42c963 Mon Sep 17 00:00:00 2001 From: "Christopher K. Hoadley" Date: Sun, 3 Feb 2019 11:48:26 -0600 Subject: [PATCH 5/6] Add Vimeo to tests. --- data.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/data.json b/data.json index 21c0f43a..d1aa7a16 100644 --- a/data.json +++ b/data.json @@ -820,11 +820,12 @@ "username_unclaimed": "noonewouldeverusethis7" }, "Vimeo": { - "errorMsg": "404 Not Found", - "errorType": "message", + "errorType": "status_code", "rank": 139, "url": "https://vimeo.com/{}", - "urlMain": "https://vimeo.com/" + "urlMain": "https://vimeo.com/", + "username_claimed": "blue", + "username_unclaimed": "noonewouldeverusethis7" }, "VirusTotal": { "errorMsg": "not found", From c5a76da21d4e607e07b535f55c5272385348b1e7 Mon Sep 17 00:00:00 2001 From: "Christopher K. Hoadley" Date: Sun, 3 Feb 2019 11:49:37 -0600 Subject: [PATCH 6/6] Add VSCO to tests. --- data.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data.json b/data.json index d1aa7a16..d650ee2d 100644 --- a/data.json +++ b/data.json @@ -809,7 +809,9 @@ "errorType": "status_code", "rank": 3373, "url": "https://vsco.co/{}", - "urlMain": "https://vsco.co/" + "urlMain": "https://vsco.co/", + "username_claimed": "blue", + "username_unclaimed": "noonewouldeverusethis7" }, "Venmo": { "errorType": "status_code",