From 143db4f9d3cb4bd4f6952c89f921ce6d277c9533 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 15 Mar 2021 11:09:32 +0100 Subject: tests: Don't download TLD list (cherry picked from commit 9303e6a85489775f63b5d15b7bbd3173f74764d9) --- misc/userscripts/qute-lastpass | 9 ++++++++- tests/unit/misc/userscripts/test_qute_lastpass.py | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/misc/userscripts/qute-lastpass b/misc/userscripts/qute-lastpass index ac9783641..d2a72f077 100755 --- a/misc/userscripts/qute-lastpass +++ b/misc/userscripts/qute-lastpass @@ -60,6 +60,8 @@ argument_parser.add_argument('--io-encoding', '-i', default='UTF-8', help='Encoding used to communicate with subprocesses') argument_parser.add_argument('--merge-candidates', '-m', action='store_true', help='Merge pass candidates for fully-qualified and registered domain name') +argument_parser.add_argument('--no-tld-download', action='store_true', + help="Don't download TLD list") group = argument_parser.add_mutually_exclusive_group() group.add_argument('--username-only', '-e', action='store_true', help='Only insert username') @@ -117,7 +119,12 @@ def main(arguments): argument_parser.print_help() return ExitCodes.FAILURE - extract_result = tldextract.extract(arguments.url) + if arguments.no_tld_download: + extract = tldextract.TLDExtract(suffix_list_urls=None) + else: + extract = tldextract.extract + + extract_result = extract(arguments.url) # Try to find candidates using targets in the following order: fully-qualified domain name (includes subdomains), # the registered domain name and finally: the IPv4 address if that's what diff --git a/tests/unit/misc/userscripts/test_qute_lastpass.py b/tests/unit/misc/userscripts/test_qute_lastpass.py index 3846028ee..24272a048 100644 --- a/tests/unit/misc/userscripts/test_qute_lastpass.py +++ b/tests/unit/misc/userscripts/test_qute_lastpass.py @@ -79,6 +79,7 @@ def arguments_mock(): arguments.merge_candidates = False arguments.password_only = False arguments.username_only = False + arguments.no_tld_download = True return arguments -- cgit v1.2.3-54-g00ecf