2019-01-22 01:26:07 +00:00
|
|
|
"""Sherlock Tests
|
|
|
|
|
|
|
|
This module contains various tests.
|
|
|
|
"""
|
|
|
|
from tests.base import SherlockBaseTest
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
|
|
|
|
class SherlockDetectTests(SherlockBaseTest):
|
|
|
|
def test_detect_true(self):
|
|
|
|
"""Test Username Existence Detection.
|
|
|
|
|
|
|
|
This test ensures that the mechanism of ensuring that a Username
|
|
|
|
exists works properly.
|
|
|
|
|
|
|
|
Keyword Arguments:
|
|
|
|
self -- This object.
|
|
|
|
|
|
|
|
Return Value:
|
|
|
|
N/A.
|
|
|
|
Will trigger an assert if Usernames which are known to exist are
|
|
|
|
not detected.
|
|
|
|
"""
|
|
|
|
|
|
|
|
self.username_check(['jack'], ['Twitter'], exist_check=True)
|
2019-01-23 02:16:19 +00:00
|
|
|
self.username_check(['dfox'], ['devRant'], exist_check=True)
|
2019-01-22 01:26:07 +00:00
|
|
|
self.username_check(['blue'], ['Pinterest'], exist_check=True)
|
|
|
|
self.username_check(['kevin'], ['Instagram'], exist_check=True)
|
|
|
|
self.username_check(['zuck'], ['Facebook'], exist_check=True)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
def test_detect_false_via_message(self):
|
|
|
|
"""Test Username Does Not Exist (Via Message).
|
|
|
|
|
|
|
|
This test ensures that the "message" detection mechanism of
|
|
|
|
ensuring that a Username does *not* exist works properly.
|
|
|
|
|
|
|
|
Keyword Arguments:
|
|
|
|
self -- This object.
|
|
|
|
|
|
|
|
Return Value:
|
|
|
|
N/A.
|
|
|
|
Will trigger an assert if detection mechanism did not work as expected.
|
|
|
|
"""
|
|
|
|
|
|
|
|
self.username_check(['jackkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk'],
|
|
|
|
['Instagram'],
|
|
|
|
exist_check=False
|
|
|
|
)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
def test_detect_false_via_status_code(self):
|
|
|
|
"""Test Username Does Not Exist (Via Status Code).
|
|
|
|
|
|
|
|
This test ensures that the "status code" detection mechanism of
|
|
|
|
ensuring that a Username does *not* exist works properly.
|
|
|
|
|
|
|
|
Keyword Arguments:
|
|
|
|
self -- This object.
|
|
|
|
|
|
|
|
Return Value:
|
|
|
|
N/A.
|
|
|
|
Will trigger an assert if detection mechanism did not work as expected.
|
|
|
|
"""
|
|
|
|
|
|
|
|
self.username_check(['jackkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk'],
|
|
|
|
['Facebook'],
|
|
|
|
exist_check=False
|
|
|
|
)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
def test_detect_false_via_response_url(self):
|
|
|
|
"""Test Username Does Not Exist (Via Response URL).
|
|
|
|
|
|
|
|
This test ensures that the "response URL" detection mechanism of
|
|
|
|
ensuring that a Username does *not* exist works properly.
|
|
|
|
|
|
|
|
Keyword Arguments:
|
|
|
|
self -- This object.
|
|
|
|
|
|
|
|
Return Value:
|
|
|
|
N/A.
|
|
|
|
Will trigger an assert if detection mechanism did not work as expected.
|
|
|
|
"""
|
|
|
|
|
|
|
|
self.username_check(['jackkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk'],
|
|
|
|
['Pinterest'],
|
|
|
|
exist_check=False
|
|
|
|
)
|
|
|
|
|
|
|
|
return
|
2019-01-23 02:16:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SherlockSiteCoverageTests(SherlockBaseTest):
|
|
|
|
def test_coverage_false_via_response_url(self):
|
|
|
|
"""Test Username Does Not Exist Site Coverage (Via Response URL).
|
|
|
|
|
|
|
|
This test checks all sites with the "response URL" 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'],
|
|
|
|
["Pinterest", "iMGSRC.RU", "Pastebin",
|
2019-01-24 01:13:09 +00:00
|
|
|
"WordPress", "devRant", "ImageShack", "MeetMe",
|
2019-01-30 23:25:05 +00:00
|
|
|
"EyeEm", "CreativeMarket", "EVE Online", "Canva"
|
2019-01-23 02:16:19 +00:00
|
|
|
],
|
|
|
|
exist_check=False
|
|
|
|
)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
def test_coverage_true_via_response_url(self):
|
|
|
|
"""Test Username Does Exist Site Coverage (Via Response URL).
|
|
|
|
|
|
|
|
This test checks all sites with the "response URL" 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'],
|
|
|
|
["Pinterest", "iMGSRC.RU", "Pastebin",
|
2019-01-24 01:13:09 +00:00
|
|
|
"WordPress", "devRant", "ImageShack", "MeetMe",
|
2019-01-30 23:25:05 +00:00
|
|
|
"EyeEm", "CreativeMarket", "EVE Online", "Canva"
|
2019-01-23 02:16:19 +00:00
|
|
|
],
|
|
|
|
exist_check=True
|
|
|
|
)
|
|
|
|
|
|
|
|
return
|
2019-01-30 23:45:36 +00:00
|
|
|
|
|
|
|
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'],
|
2019-01-30 23:51:46 +00:00
|
|
|
["Academia.edu", "9GAG", "About.me", "AngelList",
|
2019-01-31 00:07:29 +00:00
|
|
|
"BLIP.fm", "Bandcamp", "Behance", "BuzzFeed",
|
2019-01-31 00:15:42 +00:00
|
|
|
"Codecademy", "Codementor", "Designspiration"
|
2019-01-30 23:45:36 +00:00
|
|
|
],
|
|
|
|
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'],
|
2019-01-30 23:51:46 +00:00
|
|
|
["Academia.edu", "9GAG", "About.me", "AngelList",
|
2019-01-31 00:07:29 +00:00
|
|
|
"BLIP.fm", "Bandcamp", "Behance", "BuzzFeed",
|
2019-01-31 00:15:42 +00:00
|
|
|
"Codecademy", "Codementor", "Designspiration"
|
2019-01-30 23:45:36 +00:00
|
|
|
],
|
|
|
|
exist_check=True
|
|
|
|
)
|
|
|
|
|
|
|
|
return
|