Merge pull request #248 from sherlock-project/tests_ci_update

Robustness Update For CI Tests (Part 1)
pull/251/head
Christopher Kent Hoadley 6 years ago committed by GitHub
commit 6146a8040b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,7 +17,7 @@ before_script:
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
script: script:
- python -m unittest tests.all --buffer --verbose || true - python -m unittest tests.all.SherlockDetectTests --buffer --verbose || true
notifications: notifications:
on_success: change on_success: change
on_failure: change # `always` will be the setting once code changes slow down on_failure: change # `always` will be the setting once code changes slow down

@ -7,26 +7,30 @@ import unittest
class SherlockDetectTests(SherlockBaseTest): class SherlockDetectTests(SherlockBaseTest):
def test_detect_true(self): def test_detect_true_via_message(self):
"""Test Username Existence Detection. """Test Username Does Exist (Via Message).
This test ensures that the mechanism of ensuring that a Username This test ensures that the "message" detection mechanism of
exists works properly. ensuring that a Username does exist works properly.
Keyword Arguments: Keyword Arguments:
self -- This object. self -- This object.
Return Value: Return Value:
N/A. N/A.
Will trigger an assert if Usernames which are known to exist are Will trigger an assert if detection mechanism did not work as expected.
not detected.
""" """
self.username_check(['jack'], ['Twitter'], exist_check=True) site = 'Instagram'
self.username_check(['dfox'], ['devRant'], exist_check=True) site_data = self.site_data_all[site]
self.username_check(['blue'], ['Pinterest'], exist_check=True)
self.username_check(['kevin'], ['Instagram'], exist_check=True) #Ensure that the site's detection method has not changed.
self.username_check(['zuck'], ['Facebook'], exist_check=True) self.assertEqual("message", site_data["errorType"])
self.username_check([site_data["username_claimed"]],
[site],
exist_check=True
)
return return
@ -44,13 +48,46 @@ class SherlockDetectTests(SherlockBaseTest):
Will trigger an assert if detection mechanism did not work as expected. Will trigger an assert if detection mechanism did not work as expected.
""" """
self.username_check(['jackkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk'], site = 'Instagram'
['Instagram'], site_data = self.site_data_all[site]
#Ensure that the site's detection method has not changed.
self.assertEqual("message", site_data["errorType"])
self.username_check([site_data["username_unclaimed"]],
[site],
exist_check=False exist_check=False
) )
return return
def test_detect_true_via_status_code(self):
"""Test Username Does Exist (Via Status Code).
This test ensures that the "status code" detection mechanism of
ensuring that a Username does exist works properly.
Keyword Arguments:
self -- This object.
Return Value:
N/A.
Will trigger an assert if detection mechanism did not work as expected.
"""
site = 'Facebook'
site_data = self.site_data_all[site]
#Ensure that the site's detection method has not changed.
self.assertEqual("status_code", site_data["errorType"])
self.username_check([site_data["username_claimed"]],
[site],
exist_check=True
)
return
def test_detect_false_via_status_code(self): def test_detect_false_via_status_code(self):
"""Test Username Does Not Exist (Via Status Code). """Test Username Does Not Exist (Via Status Code).
@ -65,13 +102,46 @@ class SherlockDetectTests(SherlockBaseTest):
Will trigger an assert if detection mechanism did not work as expected. Will trigger an assert if detection mechanism did not work as expected.
""" """
self.username_check(['jackkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk'], site = 'Facebook'
['Facebook'], site_data = self.site_data_all[site]
#Ensure that the site's detection method has not changed.
self.assertEqual("status_code", site_data["errorType"])
self.username_check([site_data["username_unclaimed"]],
[site],
exist_check=False exist_check=False
) )
return 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:
N/A.
Will trigger an assert if detection mechanism did not work as expected.
"""
site = 'Quora'
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): def test_detect_false_via_response_url(self):
"""Test Username Does Not Exist (Via Response URL). """Test Username Does Not Exist (Via Response URL).
@ -86,8 +156,14 @@ class SherlockDetectTests(SherlockBaseTest):
Will trigger an assert if detection mechanism did not work as expected. Will trigger an assert if detection mechanism did not work as expected.
""" """
self.username_check(['jackkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk'], site = 'Quora'
['Pinterest'], 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 exist_check=False
) )

Loading…
Cancel
Save