Пример #1
0
 def __init__(self):
     submod = get_service_name() or 'kb_quast'
     self.userlog = log.log(
         submod, ip_address=True, authuser=True, module=True, method=True,
         call_id=True, changecallback=self.logcallback,
         config=get_config_file())
     self.serverlog = log.log(
         submod, ip_address=True, authuser=True, module=True, method=True,
         call_id=True, logfile=self.userlog.get_log_file())
     self.serverlog.set_log_level(6)
     self.rpc_service = JSONRPCServiceCustom()
     self.method_authentication = dict()
     self.rpc_service.add(impl_kb_quast.run_QUAST_app,
                          name='kb_quast.run_QUAST_app',
                          types=[dict])
     self.method_authentication['kb_quast.run_QUAST_app'] = 'required' # noqa
     self.rpc_service.add(impl_kb_quast.run_QUAST,
                          name='kb_quast.run_QUAST',
                          types=[dict])
     self.method_authentication['kb_quast.run_QUAST'] = 'required' # noqa
     self.rpc_service.add(impl_kb_quast.status,
                          name='kb_quast.status',
                          types=[dict])
     authurl = config.get(AUTH) if config else None
     self.auth_client = _KBaseAuth(authurl)
Пример #2
0
 def setUpClass(cls):
     cls.token = environ.get('KB_AUTH_TOKEN', None)
     config_file = environ.get('KB_DEPLOYMENT_CONFIG', None)
     cls.cfg = {}
     config = ConfigParser()
     config.read(config_file)
     for nameval in config.items('kb_quast'):
         cls.cfg[nameval[0]] = nameval[1]
     authServiceUrl = cls.cfg.get(
         'auth-service-url',
         "https://kbase.us/services/authorization/Sessions/Login")
     auth_client = _KBaseAuth(authServiceUrl)
     user_id = auth_client.get_user(cls.token)
     # 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,
         'user_id':
         user_id,
         'provenance': [{
             'service': 'kb_quast',
             'method': 'please_never_use_it_in_production',
             'method_params': []
         }],
         'authenticated':
         1
     })
     cls.shockURL = cls.cfg['shock-url']
     cls.ws = Workspace(cls.cfg['workspace-url'], token=cls.token)
     cls.hs = HandleService(url=cls.cfg['handle-service-url'],
                            token=cls.token)
     cls.au = AssemblyUtil(os.environ['SDK_CALLBACK_URL'])
     cls.impl = kb_quast(cls.cfg)
     cls.scratch = cls.cfg['scratch']
     shutil.rmtree(cls.scratch)
     os.mkdir(cls.scratch)
     suffix = int(time.time() * 1000)
     wsName = "test_ReadsUtils_" + str(suffix)
     cls.ws_info = cls.ws.create_workspace({'workspace': wsName})
     cls.dfu = DataFileUtil(os.environ['SDK_CALLBACK_URL'])
     cls.staged = {}
     cls.nodes_to_delete = []
     cls.handles_to_delete = []
     #         cls.setupTestData()
     print('\n\n=============== Starting tests ==================')