コード例 #1
0
ファイル: pep_utils.py プロジェクト: telefonicaid/iotqatools
    def request_cb_operation(self, username, password, service, subservice,
                             cb_method, cb_method_kwargs):
        self.log.info('Getting token')
        token = KeystoneUtils.get_token(username,
                                        password,
                                        service,
                                        ip=self.ip).headers
        self.log.debug('The token is: %s' % token)
        self.log.info('Creating the headers')

        headers = {
            "Accept": "application/json",
            'content-type': 'application/json',
            'Fiware-Servicepath': '/' + str(subservice),
            'X-Auth-Token': token['x-subject-token']
        }
        self.log.debug('The headers are: %s' % headers)
        self.log.info('Executing the method %s of \'cbUtils\'' % cb_method)
        self.log.debug('The info of the \'cbUtils\' arguments are: %s' %
                       cb_method_kwargs)
        cb = CBUtils(self.ip,
                     port=self.port,
                     default_headers=headers,
                     verbosity=2)
        cb_func = getattr(cb, cb_method)
        return cb_func(**cb_method_kwargs)
コード例 #2
0
 def setUp(self):
     self.cb = CBUtils(instance='mock.cb.com', port="1026", verbosity=0)