|
|
|
@ -4,7 +4,7 @@ This module contains various tests.
|
|
|
|
|
"""
|
|
|
|
|
from tests.base import SherlockBaseTest
|
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
|
|
import secrets
|
|
|
|
|
|
|
|
|
|
class SherlockDetectTests(SherlockBaseTest):
|
|
|
|
|
def test_detect_true_via_message(self):
|
|
|
|
@ -54,7 +54,7 @@ class SherlockDetectTests(SherlockBaseTest):
|
|
|
|
|
#Ensure that the site's detection method has not changed.
|
|
|
|
|
self.assertEqual("message", site_data["errorType"])
|
|
|
|
|
|
|
|
|
|
self.username_check([site_data["username_unclaimed"]],
|
|
|
|
|
self.username_check([secrets.token_urlsafe(10)],
|
|
|
|
|
[site],
|
|
|
|
|
exist_check=False
|
|
|
|
|
)
|
|
|
|
@ -108,66 +108,13 @@ class SherlockDetectTests(SherlockBaseTest):
|
|
|
|
|
#Ensure that the site's detection method has not changed.
|
|
|
|
|
self.assertEqual("status_code", site_data["errorType"])
|
|
|
|
|
|
|
|
|
|
self.username_check([site_data["username_unclaimed"]],
|
|
|
|
|
self.username_check([secrets.token_urlsafe(10)],
|
|
|
|
|
[site],
|
|
|
|
|
exist_check=False
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
def test_detect_true_via_response_url(self):
|
|
|
|
|
"""Test Username Does Exist (Via Response URL).
|
|
|
|
|
|
|
|
|
|
This test ensures that the "response URL" detection mechanism of
|
|
|
|
|
ensuring that a Username does exist works properly.
|
|
|
|
|
|
|
|
|
|
Keyword Arguments:
|
|
|
|
|
self -- This object.
|
|
|
|
|
|
|
|
|
|
Return Value:
|
|
|
|
|
Nothing.
|
|
|
|
|
Will trigger an assert if detection mechanism did not work as expected.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
site = "VK"
|
|
|
|
|
site_data = self.site_data_all[site]
|
|
|
|
|
|
|
|
|
|
#Ensure that the site's detection method has not changed.
|
|
|
|
|
self.assertEqual("response_url", site_data["errorType"])
|
|
|
|
|
|
|
|
|
|
self.username_check([site_data["username_claimed"]],
|
|
|
|
|
[site],
|
|
|
|
|
exist_check=True
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
Nothing.
|
|
|
|
|
Will trigger an assert if detection mechanism did not work as expected.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
site = "VK"
|
|
|
|
|
site_data = self.site_data_all[site]
|
|
|
|
|
|
|
|
|
|
#Ensure that the site's detection method has not changed.
|
|
|
|
|
self.assertEqual("response_url", site_data["errorType"])
|
|
|
|
|
|
|
|
|
|
self.username_check([site_data["username_unclaimed"]],
|
|
|
|
|
[site],
|
|
|
|
|
exist_check=False
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SherlockSiteCoverageTests(SherlockBaseTest):
|
|
|
|
|