fixed tests

pull/1679/head
Siddharth Dushantha 2 years ago
parent 1c64c28238
commit 87c3e8e091

@ -9,7 +9,7 @@ import secrets
class SiteInformation:
def __init__(self, name, url_home, url_username_format, username_claimed,
username_unclaimed, information, is_nsfw):
information, is_nsfw, username_unclaimed=secrets.token_urlsafe(10)):
"""Create Site Information Object.
Contains information about a specific website.
@ -164,7 +164,6 @@ class SitesInformation:
site_data[site_name]["urlMain"],
site_data[site_name]["url"],
site_data[site_name]["username_claimed"],
site_data[site_name]["username_unclaimed"],
site_data[site_name],
site_data[site_name].get("isNSFW",False)

@ -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):

Loading…
Cancel
Save