diff --git a/data.json b/data.json index 4858d42a..1ea77c5f 100644 --- a/data.json +++ b/data.json @@ -19,15 +19,13 @@ "urlMain": "https://about.me/" }, "Academia.edu": { - "errorMsg": "Page Not Found", - "errorType": "message", + "errorType": "status_code", "rank": 385, "url": "https://independent.academia.edu/{}", "urlMain": "https://www.academia.edu/" }, "AngelList": { - "errorMsg": "We couldn't find what you were looking for.", - "errorType": "message", + "errorType": "status_code", "rank": 3469, "url": "https://angel.co/{}", "urlMain": "https://angel.co/" @@ -45,8 +43,7 @@ "urlMain": "https://ask.fm/" }, "BLIP.fm": { - "errorMsg": "Page Not Found", - "errorType": "message", + "errorType": "status_code", "rank": 261919, "url": "https://blip.fm/{}", "urlMain": "https://blip.fm/" @@ -58,8 +55,7 @@ "urlMain": "https://badoo.com/" }, "Bandcamp": { - "errorMsg": "Sorry, that something isn\u2019t here", - "errorType": "message", + "errorType": "status_code", "rank": 573, "url": "https://www.bandcamp.com/{}", "urlMain": "https://www.bandcamp.com/" @@ -72,8 +68,7 @@ "urlMain": "https://basecamp.com/" }, "Behance": { - "errorMsg": "Oops! We can\u2019t find that page.", - "errorType": "message", + "errorType": "status_code", "rank": 394, "url": "https://www.behance.net/{}", "urlMain": "https://www.behance.net/" @@ -99,15 +94,14 @@ "urlMain": "https://www.blogger.com/" }, "BuzzFeed": { - "errorMsg": "We can't find the page you're looking for.", - "errorType": "message", + "errorType": "status_code", "rank": 294, "url": "https://buzzfeed.com/{}", "urlMain": "https://buzzfeed.com/" }, - "Canva": { - "errorMsg": "Not found (404)", - "errorType": "message", + "Canva": { + "errorType": "response_url", + "errorUrl": "https://www.canva.com/{}", "rank": 215, "url": "https://www.canva.com/{}", "urlMain": "https://www.canva.com/" @@ -132,15 +126,13 @@ "urlMain": "https://www.cloob.com/" }, "Codecademy": { - "errorMsg": "404 error", - "errorType": "message", + "errorType": "status_code", "rank": 2314, "url": "https://www.codecademy.com/{}", "urlMain": "https://www.codecademy.com/" }, "Codementor": { - "errorMsg": "404", - "errorType": "message", + "errorType": "status_code", "rank": 12456, "url": "https://www.codementor.io/{}", "urlMain": "https://www.codementor.io/" @@ -205,10 +197,9 @@ "urlMain": "https://www.dailymotion.com/" }, "Designspiration": { - "errorMsg": "Content Not Found", - "errorType": "message", + "errorType": "status_code", "rank": 24722, - "url": "https://www.designspiration.net/{}", + "url": "https://www.designspiration.net/{}/", "urlMain": "https://www.designspiration.net/" }, "DeviantART": { diff --git a/sherlock.py b/sherlock.py index adc942d6..03d5407b 100644 --- a/sherlock.py +++ b/sherlock.py @@ -13,6 +13,7 @@ import os import platform import re import sys +import random from argparse import ArgumentParser, RawDescriptionHelpFormatter from concurrent.futures import ThreadPoolExecutor from time import time diff --git a/tests/all.py b/tests/all.py index c486c608..e21e960f 100644 --- a/tests/all.py +++ b/tests/all.py @@ -112,7 +112,7 @@ class SherlockSiteCoverageTests(SherlockBaseTest): self.username_check(['noonewouldeverusethis7'], ["Pinterest", "iMGSRC.RU", "Pastebin", "WordPress", "devRant", "ImageShack", "MeetMe", - "EyeEm", "CreativeMarket", "EVE Online" + "EyeEm", "CreativeMarket", "EVE Online", "Canva" ], exist_check=False ) @@ -136,7 +136,99 @@ class SherlockSiteCoverageTests(SherlockBaseTest): self.username_check(['blue'], ["Pinterest", "iMGSRC.RU", "Pastebin", "WordPress", "devRant", "ImageShack", "MeetMe", - "EyeEm", "CreativeMarket", "EVE Online" + "EyeEm", "CreativeMarket", "EVE Online", "Canva" + ], + exist_check=True + ) + + return + + def test_coverage_false_via_status(self): + """Test Username Does Not Exist Site Coverage (Via HTTP Status). + + This test checks all sites with the "HTTP Status" detection mechanism + to ensure that a Username that does not exist is reported that way. + + Keyword Arguments: + self -- This object. + + Return Value: + N/A. + Will trigger an assert if detection mechanism did not work as expected. + """ + + self.username_check(['noonewouldeverusethis7'], + ["Academia.edu", "9GAG", "About.me", "AngelList", + "BLIP.fm", "Bandcamp", "Behance", "BuzzFeed", + "Codecademy", "Codementor", "Designspiration" + ], + exist_check=False + ) + + return + + def test_coverage_true_via_status(self): + """Test Username Does Exist Site Coverage (Via HTTP Status). + + This test checks all sites with the "HTTP Status" detection mechanism + to ensure that a Username that does exist is reported that way. + + Keyword Arguments: + self -- This object. + + Return Value: + N/A. + Will trigger an assert if detection mechanism did not work as expected. + """ + + self.username_check(['blue'], + ["Academia.edu", "9GAG", "About.me", "AngelList", + "BLIP.fm", "Bandcamp", "Behance", "BuzzFeed", + "Codecademy", "Codementor", "Designspiration" + ], + exist_check=True + ) + + return + + def test_coverage_false_via_message(self): + """Test Username Does Not Exist Site Coverage (Via Error Message). + + This test checks all sites with the "Error Message" detection mechanism + to ensure that a Username that does not exist is reported that way. + + Keyword Arguments: + self -- This object. + + Return Value: + N/A. + Will trigger an assert if detection mechanism did not work as expected. + """ + + self.username_check(['noonewouldeverusethis7'], + ["Dribbble" + ], + exist_check=False + ) + + return + + def test_coverage_true_via_message(self): + """Test Username Does Exist Site Coverage (Via Error Message). + + This test checks all sites with the "Error Message" detection mechanism + to ensure that a Username that does exist is reported that way. + + Keyword Arguments: + self -- This object. + + Return Value: + N/A. + Will trigger an assert if detection mechanism did not work as expected. + """ + + self.username_check(['blue'], + ["Dribbble" ], exist_check=True )