def setUp(self): self.ch = ConfigHolder() self.ch.set('serviceurl', endpoint) self.ch.set('verboseLevel', 3) self.client = Client(self.ch) self.client.login(username, password) self.ch.set('endpoint', endpoint) self.ch.set('session', self.client.get_session())
def get_rtp_all(side_effect, no_block=False): ch = ConfigHolder() ch.set('noBlock', no_block) ch.set('timeout', 1) ch.set('verboseLevel', 3) ch.set('endpoint', 'https://foo.bar') Client._getRuntimeParameter = Mock(side_effect=side_effect) client = Client(ch) client.httpClient.getRuntimeParameter = Mock(side_effect=side_effect) return client.get_rtp_all('foo', 'bar')
def test_constructor(self): ch = ConfigHolder() ch.context = {} ch.options = {} ch.config = {} Client(ch) ch.context = {} ch.options = {} ch.config = {'endpoint': 'foo/bar'} c = Client(ch) assert c.ch.endpoint == c.ch.serviceurl == 'foo/bar' ch.context = {} ch.options = {} ch.config = {'serviceurl': 'bar/baz'} c = Client(ch) assert c.ch.serviceurl == 'bar/baz' assert not hasattr(c.ch, 'endpoint')
def doWork(self): ch = ConfigHolder(self.options) client = Client(ch) if self.options.cancel: client.cancel_abort() else: value = truncate_middle(Client.VALUE_LENGTH_LIMIT, self.reason, '\n(truncated)\n') client.setRuntimeParameter(NodeDecorator.ABORT_KEY, value)
def doWork(self): rvalue = ''.join([random.choice(string.ascii_letters + string.digits) for _ in xrange(self.size)]) if self.key is not None: ch = ConfigHolder(self.options) client = Client(ch) client.setRuntimeParameter(self.key, rvalue) print(rvalue)
def test_do_not_qualify_parameter(self): orch_node_name = NodeDecorator.orchestratorName + '-cloudX' orch_param = orch_node_name + \ NodeDecorator.NODE_PROPERTY_SEPARATOR + \ 'foo' context = {NodeDecorator.NODE_INSTANCE_NAME_KEY: orch_node_name} ch = ConfigHolder(context=context, config={ 'bar': 'baz', 'endpoint': 'https://foo.bar' }) c = Client(ch) assert orch_param == c._qualifyKey(orch_param)
def doWork(self): ch = ConfigHolder(self.options, context={'empty': None}, config={'empty': None}) client = Client(ch) client.login(self.username, self.password)
def doWork(self): ch = ConfigHolder(self.options) client = Client(ch) client.cancel_abort()
def doWork(self): ch = ConfigHolder(self.options) client = Client(ch) client.terminateRun()
def _init_client(self): configHolder = ConfigHolder(self.options, context={'empty': None}, config={'empty': None}) configHolder.set('serviceurl', self.options.endpoint) self.client = Client(configHolder)
def doWork(self): ch = ConfigHolder(self.options) client = Client(ch) client.logout()
def _get_client(self): ch = ConfigHolder(self.options) return Client(ch)
def doWork(self): ch = ConfigHolder(self.options) client = Client(ch) value = client.getRuntimeParameter(self.key) print(value if value is not None else '')
def doWork(self): ch = ConfigHolder(self.options) client = Client(ch) client.setRuntimeParameter(self.key, self.value)
def _get_config_from_server(self): ch = ConfigHolder(options=self.options, context={'foo': 'bar'}, config={'verboseLevel': self.verboseLevel}) client = Client(ch) return client.get_server_configuration()