def __request(self, request): # call a method on the remote server response = self.__transport.request(request) logger.debug('got response from __transport :: %s' % response) if type(response) is not int: return json.loads(response) else: logger.error('Recieved status code %s' % response)
def __call__(self): from windmill.bin import shell_objects client = shell_objects.xmlrpc_client self.do_test = getattr(client, self.do_test) self.do_command = getattr(client, self.do_command) client.start_suite(self.name) for line in self.lines: if json.loads(line)['method'].find('command') is -1: result = self.do_test(line) if not self.debugging: assert result['result'] else: result = self.do_command(line) if not self.debugging: assert result
def run_json_tests(self, tests): """Run list of json tests""" return self.run_tests([json.loads(test) for test in tests])
def execute_json_test(self, json): """Add test from json object with 'method' and 'params' defined, block until it returns, return the result""" action_object = json.loads(json) return self.execute_object(self._queue.add_test, self._test_resolution_suite, action_object)
def add_json_command(self, json): """Add command from json object with 'method' and 'params' defined""" action_object = json.loads(json) self.add_object(self._queue.add_command, action_object) return 200
def add_json_test(self, json, suite_name=None): """Add test from json object with 'method' and 'params' defined""" action_object = json.loads(json) self.add_object(self._queue.add_test, action_object, suite_name) return 200
def transform_json_to_python(json_strings): """Transform serialized JSON objects to python code using the windmill transformer architecture""" tests = [] for line in json_strings: tests.append(json.loads(line)) return transforms.build_test_file(tests)
def _decode(self, s): """Internal method for decoding json objects, uses simplejson""" return json.loads(s)