Merge pull request #1368 from ediamantopoulou/feature

Add number of results in the end of the process
pull/1328/merge
Yahya SayadArbabi 2 years ago committed by GitHub
commit a2c630ee31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -5,7 +5,7 @@ results of queries.
""" """
from result import QueryStatus from result import QueryStatus
from colorama import Fore, Style from colorama import Fore, Style
globvar = 0 # global variable to count the number of results.
class QueryNotify: class QueryNotify:
"""Query Notify Object. """Query Notify Object.
@ -103,7 +103,6 @@ class QueryNotify:
""" """
return str(self.result) return str(self.result)
class QueryNotifyPrint(QueryNotify): class QueryNotifyPrint(QueryNotify):
"""Query Notify Print Object. """Query Notify Print Object.
@ -185,6 +184,20 @@ class QueryNotifyPrint(QueryNotify):
# return # return
def countResults(self):
"""This function counts the number of results. Every time the fuction is called,
the number of results is increasing.
Keyword Arguments:
self -- This object.
Return Value:
The number of results by the time we call the function.
"""
global globvar
globvar += 1
return globvar
def update(self, result): def update(self, result):
"""Notify Update. """Notify Update.
@ -206,6 +219,7 @@ class QueryNotifyPrint(QueryNotify):
# Output to the terminal is desired. # Output to the terminal is desired.
if result.status == QueryStatus.CLAIMED: if result.status == QueryStatus.CLAIMED:
self.countResults()
print(Style.BRIGHT + Fore.WHITE + "[" + print(Style.BRIGHT + Fore.WHITE + "[" +
Fore.GREEN + "+" + Fore.GREEN + "+" +
Fore.WHITE + "]" + Fore.WHITE + "]" +
@ -255,10 +269,18 @@ class QueryNotifyPrint(QueryNotify):
Will print the last line to the standard output. Will print the last line to the standard output.
Keyword Arguments: Keyword Arguments:
self -- This object. self -- This object.
message -- The last phrase. message -- The 2 last phrases.
Return Value: Return Value:
Nothing. Nothing.
""" """
NumberOfResults = self.countResults() - 1
title = "Results:"
print(Style.BRIGHT + Fore.GREEN + "[" +
Fore.YELLOW + "*" +
Fore.GREEN + f"] {title}" +
Fore.WHITE + f" {NumberOfResults}" )
title = "End" title = "End"

@ -7,7 +7,19 @@ import sherlock as sh
checksymbols = [] checksymbols = []
checksymbols = ["_", "-", "."] checksymbols = ["_", "-", "."]
class TestMulripleUsernames(unittest.TestCase): """Test for mulriple usernames.
This test ensures that the function MultipleUsernames works properly. More specific,
different scenarios are tested and only usernames that contain this specific sequence: {?}
should return positive.
Keyword Arguments:
self -- This object.
Return Value:
Nothing.
"""
class TestMultipleUsernames(unittest.TestCase):
def test_area(self): def test_area(self):
test_usernames = ["test{?}test" , "test{?feo" , "test"] test_usernames = ["test{?}test" , "test{?feo" , "test"]
for name in test_usernames: for name in test_usernames:

Loading…
Cancel
Save