def setUpClass(cls): cls.token = environ.get('KB_AUTH_TOKEN') cls.callbackURL = environ.get('SDK_CALLBACK_URL') print('CB URL: ' + cls.callbackURL) # WARNING: don't call any logging methods on the context object, # it'll result in a NoneType error cls.ctx = MethodContext(None) cls.ctx.update({ 'token': cls.token, 'provenance': [{ 'service': 'kb_SPAdes', 'method': 'please_never_use_it_in_production', 'method_params': [] }], 'authenticated': 1 }) config_file = environ.get('KB_DEPLOYMENT_CONFIG', None) cls.cfg = {} config = ConfigParser() config.read(config_file) for nameval in config.items('kb_SPAdes'): cls.cfg[nameval[0]] = nameval[1] cls.wsURL = cls.cfg['workspace-url'] cls.shockURL = cls.cfg['shock-url'] cls.hs = HandleService(url=cls.cfg['handle-service-url'], token=cls.token) cls.wsClient = workspaceService(cls.wsURL, token=cls.token) wssuffix = int(time.time() * 1000) wsName = "test_kb_SPAdes_" + str(wssuffix) cls.wsinfo = cls.wsClient.create_workspace({'workspace': wsName}) print('created workspace ' + cls.getWsName()) cls.serviceImpl = kb_SPAdes(cls.cfg) cls.readUtilsImpl = ReadsUtils(cls.callbackURL, token=cls.token) cls.staged = {} cls.nodes_to_delete = [] cls.handles_to_delete = [] cls.setupTestData() print('\n\n=============== Starting tests ==================')
def setUpClass(cls): cls.token = environ.get('KB_AUTH_TOKEN') cls.callbackURL = environ.get('SDK_CALLBACK_URL') # WARNING: don't call any logging methods on the context object, # it'll result in a NoneType error cls.ctx = MethodContext(None) cls.ctx.update({'token': cls.token, 'provenance': [ {'service': 'kb_SPAdes', 'method': 'please_never_use_it_in_production', 'method_params': [] }], 'authenticated': 1}) config_file = environ.get('KB_DEPLOYMENT_CONFIG', None) cls.cfg = {} config = ConfigParser() config.read(config_file) for nameval in config.items('kb_SPAdes'): cls.cfg[nameval[0]] = nameval[1] cls.cfg["SDK_CALLBACK_URL"] = cls.callbackURL cls.cfg["KB_AUTH_TOKEN"] = cls.token cls.serviceImpl = kb_SPAdes(cls.cfg)
def get_config(): if not get_config_file(): return None retconfig = {} config = ConfigParser() config.read(get_config_file()) for nameval in config.items(get_service_name() or 'kb_SPAdes'): retconfig[nameval[0]] = nameval[1] return retconfig config = get_config() from kb_SPAdes.kb_SPAdesImpl import kb_SPAdes # noqa @IgnorePep8 impl_kb_SPAdes = kb_SPAdes(config) class JSONObjectEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, set): return list(obj) if isinstance(obj, frozenset): return list(obj) if hasattr(obj, 'toJSONable'): return obj.toJSONable() return json.JSONEncoder.default(self, obj) class JSONRPCServiceCustom(JSONRPCService): def call(self, ctx, jsondata):