def load_address_sockfam(opts, conf): """These can be set either on the command line or in the conf file. """ if getattr(opts, 'have_address', False): # first check CLI address = opts.address sockfam = opts.sockfam elif 'address' in conf['aspen.cli']: # then check conf address, sockfam = validate_address(conf['aspen.cli']['address']) else: # default from optparse address = opts.address sockfam = socket.AF_INET return address, sockfam
def test_address_can_be_localhost(): expected = (('127.0.0.1', 8000), 2) actual = validate_address('localhost:8000') assert actual == expected, actual