Better placing + testability of socket as a cli parameter

main
Jacob Oscarson 12 years ago
parent 02288dd048
commit ef43790ba2

@ -16,7 +16,8 @@ def add_standard_arguments(parser):
help='The Redis database (default: 0)')
parser.add_argument('--password', '-a', default=None,
help='The Redis password (default: None)')
parser.add_argument('--socket', '-s', default=None,
help='The Redis Unix socket')
def read_config_file(module):
"""Reads all UPPERCASE variables defined in the given module file."""

@ -27,7 +27,6 @@ def parse_args():
parser.add_argument('--quiet', '-q', action='store_true', default=False, help='Show less output')
parser.add_argument('--sentry-dsn', action='store', default=None, metavar='URL', help='Report exceptions to this Sentry DSN')
parser.add_argument('queues', nargs='*', help='The queues to listen on (default: \'default\')')
parser.add_argument('--socket', '-s', default=None, help='Use Unix socket to connect')
return parser.parse_args()

@ -30,3 +30,13 @@ class TestScripts(TestCase):
args.socket = 'sock-from-arg'
setup_default_arguments(args, settings)
self.assertEqual(args.socket, 'sock-from-arg')
def test_add_socket_argument(self):
caught = []
args = uFaking()
args.add_argument = lambda *args, **kw: caught.append(args)
add_standard_arguments(args)
socket_parms = [e for e in caught if e[0] == '--socket']
self.assertEqual([('--socket', '-s')], socket_parms)

Loading…
Cancel
Save