예제 #1
0
    def setUpClass(cls):
        cls.token = os.environ.get('KB_AUTH_TOKEN', None)
        config_file = os.environ.get('KB_DEPLOYMENT_CONFIG', None)
        cls.cfg = {}
        config = ConfigParser()
        config.read(config_file)
        for nameval in config.items('AbstractHandle'):
            cls.cfg[nameval[0]] = nameval[1]
        cls.cfg['admin-token'] = cls.token
        cls.cfg['mongo-collection'] = 'handle'
        cls.cfg['mongo-hid-counter-collection'] = 'handle_id_counter'
        cls.cfg['mongo-authmechanism'] = 'DEFAULT'

        # Getting username from Auth profile for token
        authServiceUrl = cls.cfg['auth-service-url']
        auth_client = _KBaseAuth(authServiceUrl)
        cls.user_id = auth_client.get_user(cls.token)
        cls.shock_url = cls.cfg['shock-url']

        cls.mongo_helper = MongoHelper()
        cls.my_client = cls.mongo_helper.create_test_db(
            db=cls.cfg['mongo-database'], col=cls.cfg['mongo-collection'])
        cls.handler = Handler(cls.cfg)
        cls.mongo_util = MongoUtil(cls.cfg)

        cls.shock_ids_to_delete = list()
예제 #2
0
    def setUpClass(cls):
        config_file = os.environ.get('KB_DEPLOYMENT_CONFIG', None)
        cls.cfg = {}
        config = ConfigParser()
        config.read(config_file)
        for nameval in config.items('AbstractHandle'):
            cls.cfg[nameval[0]] = nameval[1]

        cls.cfg['mongo-collection'] = 'handle'

        cls.mongo_helper = MongoHelper()
        cls.my_client = cls.mongo_helper.create_test_db(
            db=cls.cfg['mongo-database'], col=cls.cfg['mongo-collection'])
        cls.mongo_util = MongoUtil(cls.cfg)
예제 #3
0
 def setUpClass(cls):
     cls.token = os.environ.get('KB_AUTH_TOKEN', None)
     config_file = os.environ.get('KB_DEPLOYMENT_CONFIG', None)
     cls.cfg = {}
     config = ConfigParser()
     config.read(config_file)
     for nameval in config.items('AbstractHandle'):
         cls.cfg[nameval[0]] = nameval[1]
     cls.cfg['admin-token'] = cls.token
     # Getting username from Auth profile for token
     authServiceUrl = cls.cfg['auth-service-url']
     auth_client = _KBaseAuth(authServiceUrl)
     cls.user_id = auth_client.get_user(cls.token)
     cls.shock_url = cls.cfg['shock-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,
         'user_id':
         cls.user_id,
         'provenance': [{
             'service': 'AbstractHandle',
             'method': 'please_never_use_it_in_production',
             'method_params': []
         }],
         'authenticated':
         1
     })
     cls.wsURL = cls.cfg['workspace-url']
     cls.wsClient = Workspace(cls.wsURL)
     cls.serviceImpl = AbstractHandle(cls.cfg)
     cls.scratch = cls.cfg['scratch']
     cls.callback_url = os.environ['SDK_CALLBACK_URL']
     cls.mongo_helper = MongoHelper()
     cls.my_client = cls.mongo_helper.create_test_db(
         db=cls.cfg['mongo-database'], col=cls.cfg['mongo-collection'])
     cls.mongo_util = MongoUtil(cls.cfg)
     cls.shock_ids_to_delete = list()