def configure(host=None, port=None, key=None): config = core.read_config('default') if host is None and port is None and key is None: return core.pretty_json(core.read_config()) # # print core.pretty_json(core.read_config()) else: if host: config['api']['host'] = host if port: config['api']['port'] = port if key: config['api']['key'] = key core.write_config('default', config) return core.pretty_json({'default':config})
def test_configure(self): config = {'default':{'api':{}}} config['default']['api']['host'] = '0.0.0.0' config['default']['api']['port'] = 5100 config['default']['api']['key'] = api_key coreLink.configure(host=config['default']['api']['host'], port=config['default']['api']['port'], key=config['default']['api']['key']) assert core.pretty_json(config) == coreLink.configure()
def show(name=None, tag=None, api=None, elnk=None, ctsk=None): registrations = core.read_reg('default') investigations = find_by(regs=registrations, name=name, tag=tag) if len(investigations) > 0: for investigation in investigations: # print core.pretty_json(registrations[investigation]) return core.pretty_json(registrations[investigation]) else: # print "Could not found name/tag registered." return None