From 548180749db3ef29450766333a24d4e69af0deec Mon Sep 17 00:00:00 2001 From: Evelina Diamantopoulou Date: Fri, 3 Jun 2022 17:23:55 +0300 Subject: [PATCH 1/3] add comments in: test_multiple_usernames.py --- sherlock/tests/test_multiple_usernames.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sherlock/tests/test_multiple_usernames.py b/sherlock/tests/test_multiple_usernames.py index 12aac41..0692e8f 100644 --- a/sherlock/tests/test_multiple_usernames.py +++ b/sherlock/tests/test_multiple_usernames.py @@ -7,7 +7,19 @@ import sherlock as sh 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): test_usernames = ["test{?}test" , "test{?feo" , "test"] for name in test_usernames: From 62d77c3346554443631267b0d3fe772d56400287 Mon Sep 17 00:00:00 2001 From: Evelina Diamantopoulou Date: Wed, 8 Jun 2022 17:25:17 +0300 Subject: [PATCH 2/3] add number of results in the end of the process --- sherlock/notify.py | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/sherlock/notify.py b/sherlock/notify.py index 17eafb8..a1afb9c 100644 --- a/sherlock/notify.py +++ b/sherlock/notify.py @@ -6,6 +6,7 @@ results of queries. from result import QueryStatus from colorama import Fore, Style +globvar = 0 class QueryNotify: """Query Notify Object. @@ -52,7 +53,7 @@ class QueryNotify: Nothing. """ - # return + # return def update(self, result): """Notify Update. @@ -101,8 +102,7 @@ class QueryNotify: Return Value: Nicely formatted string to get information about this object. """ - return str(self.result) - + return str(self.result) class QueryNotifyPrint(QueryNotify): """Query Notify Print Object. @@ -132,7 +132,7 @@ class QueryNotifyPrint(QueryNotify): self.print_all = print_all return - + def start(self, message): """Notify Start. @@ -185,6 +185,20 @@ class QueryNotifyPrint(QueryNotify): # return + def countResults(self): + """Count 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): """Notify Update. @@ -206,6 +220,7 @@ class QueryNotifyPrint(QueryNotify): # Output to the terminal is desired. if result.status == QueryStatus.CLAIMED: + self.countResults() print(Style.BRIGHT + Fore.WHITE + "[" + Fore.GREEN + "+" + Fore.WHITE + "]" + @@ -213,7 +228,7 @@ class QueryNotifyPrint(QueryNotify): Fore.GREEN + f" {self.result.site_name}: " + Style.RESET_ALL + - f"{self.result.site_url_user}") + f"{self.result.site_url_user}") elif result.status == QueryStatus.AVAILABLE: if self.print_all: @@ -255,11 +270,19 @@ class QueryNotifyPrint(QueryNotify): Will print the last line to the standard output. Keyword Arguments: self -- This object. - message -- The last phrase. + message -- The 2 last phrases. Return Value: Nothing. """ + numberOfResults = self.countResults() - 1 + + title = "Results:" + print(Style.BRIGHT + Fore.GREEN + "[" + + Fore.YELLOW + "*" + + Fore.GREEN + f"] {title}" + + Fore.WHITE + f" {numberOfResults}" ) + title = "End" print('\r') # An empty line between last line of main output and last line(more clear output) @@ -282,4 +305,4 @@ class QueryNotifyPrint(QueryNotify): Return Value: Nicely formatted string to get information about this object. """ - return str(self.result) + return str(self.result) \ No newline at end of file From e871a47440301fbbec0e32a7eed39a22ec2fe8e3 Mon Sep 17 00:00:00 2001 From: Evelina Diamantopoulou Date: Wed, 8 Jun 2022 17:39:33 +0300 Subject: [PATCH 3/3] add number of results in the end of the process --- sherlock/notify.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sherlock/notify.py b/sherlock/notify.py index a1afb9c..cb3ff99 100644 --- a/sherlock/notify.py +++ b/sherlock/notify.py @@ -5,8 +5,7 @@ results of queries. """ from result import QueryStatus from colorama import Fore, Style - -globvar = 0 +globvar = 0 # global variable to count the number of results. class QueryNotify: """Query Notify Object. @@ -186,7 +185,7 @@ class QueryNotifyPrint(QueryNotify): # return def countResults(self): - """Count the number of results. Every time the fuction is called, + """This function counts the number of results. Every time the fuction is called, the number of results is increasing. Keyword Arguments: @@ -274,14 +273,14 @@ class QueryNotifyPrint(QueryNotify): Return Value: Nothing. """ - numberOfResults = self.countResults() - 1 + NumberOfResults = self.countResults() - 1 title = "Results:" print(Style.BRIGHT + Fore.GREEN + "[" + Fore.YELLOW + "*" + Fore.GREEN + f"] {title}" + - Fore.WHITE + f" {numberOfResults}" ) + Fore.WHITE + f" {NumberOfResults}" ) title = "End"