def do_GET(self): # pylint: disable=invalid-name """Reply with a JSON representation of the current test state. If there is no test state make sure we still serve prompt state in case a test start trigger is waiting on a prompt. """ state = self.executor.GetState() prompt = user_input.get_prompt_manager().prompt if state: self.wfile.write(state.AsJSON()) else: result = {'state': 'NOTEST'} prompt = user_input.get_prompt_manager().prompt if prompt: result['prompt'] = util.convert_to_dict(prompt) self.wfile.write(json.JSONEncoder().encode(result))
def _asdict(self): """Return a dictionary representation of this executor.""" return { 'station_id': conf.station_id, 'prompt': user_input.get_prompt_manager().prompt, 'status': self._status.name }
def _asdict(self): """Return a dict representation of the test's state.""" prompt = user_input.get_prompt_manager().prompt return { 'state': self._state.key, 'record': self.record, 'phase_data': self.phase_data, 'running_phase': self.running_phase, 'pending_phases': [ (phase.__name__, phase.__doc__) for phase in self.pending_phases], 'prompt': prompt}
def do_POST(self): # pylint: disable=invalid-name """Parse a prompt response and send it to the PromptManager.""" length = int(self.headers.getheader('content-length')) raw = self.rfile.read(length) request = json.loads(raw) result = user_input.get_prompt_manager().Respond( uuid.UUID((request['id'])), request['response']) self.send_response(200) self.end_headers() if result: self.wfile.write(PROMPT_ACK) else: self.wfile.write(PROMPT_NACK)
def do_POST(self): # pylint: disable=invalid-name """Parse a prompt response and send it to the PromptManager.""" raw = self.rfile.read() data = json.loads(raw) user_input.get_prompt_manager().Respond(uuid.UUID((data['id'])), data['response'])
def _asdict(self): """Return a dictionary representation of this executor.""" return {'station_id': self._config.station_id, 'prompt': user_input.get_prompt_manager().prompt, 'status': self._status.name}
def do_POST(self): # pylint: disable=invalid-name """Parse a prompt response and send it to the PromptManager.""" raw = self.rfile.read() data = json.loads(raw) user_input.get_prompt_manager().Respond( uuid.UUID((data['id'])), data['response'])
def trigger(): # pylint: disable=missing-docstring prompt_manager = user_input.get_prompt_manager() return prompt_manager.DisplayPrompt(message, text_input=text_input)