cli.Config: remove common attributes

The values set by the base Config constructor could mask Click parsers
that weren't supplying defaults properly, or which were using different
defaults.
This commit is contained in:
Brian Warner 2016-07-14 22:37:35 -06:00
parent 52ef00b46b
commit 1a82846578
2 changed files with 3 additions and 20 deletions

View File

@ -22,27 +22,13 @@ class Config(object):
Union of config options that we pass down to (sub) commands.
"""
def __init__(self):
# common options
# This only holds attributes which are *not* set by CLI arguments.
# Everything else comes from Click decorators, so we can be sure
# we're exercising the defaults.
self.timing = DebugTiming()
self.tor = None
self.listen = None
self.relay_url = u""
self.transit_helper = u""
self.cwd = os.getcwd()
# send/receive commands
self.code = None
self.code_length = 2
self.verify = False
self.hide_progress = False
self.dump_timing = False
self.stdout = stdout
self.stderr = stderr
self.zeromode = False
self.accept_file = None
self.output_file = None
# send only
self.text = None
self.what = None
ALIASES = {

View File

@ -14,7 +14,6 @@ class Send(unittest.TestCase):
self.assertEqual(cfg.dump_timing, None)
self.assertEqual(cfg.hide_progress, False)
self.assertEqual(cfg.listen, True)
self.assertEqual(cfg.output_file, None)
self.assertEqual(cfg.relay_url, RENDEZVOUS_RELAY)
self.assertEqual(cfg.transit_helper, TRANSIT_RELAY)
self.assertEqual(cfg.text, "hi")
@ -70,7 +69,6 @@ class Receive(unittest.TestCase):
cfg = config("receive")
#pprint(cfg.__dict__)
self.assertEqual(cfg.accept_file, False)
self.assertEqual(cfg.what, None)
self.assertEqual(cfg.code, None)
self.assertEqual(cfg.code_length, 2)
self.assertEqual(cfg.dump_timing, None)
@ -80,7 +78,6 @@ class Receive(unittest.TestCase):
self.assertEqual(cfg.output_file, None)
self.assertEqual(cfg.relay_url, RENDEZVOUS_RELAY)
self.assertEqual(cfg.transit_helper, TRANSIT_RELAY)
self.assertEqual(cfg.text, None)
self.assertEqual(cfg.tor, False)
self.assertEqual(cfg.verify, False)
self.assertEqual(cfg.zeromode, False)