def __init__(self, data): super().__init__(data) try: parsed = json.loads(data) except ValueError: raise testprocess.InvalidLine(data) assert isinstance(parsed, dict) assert set(parsed.keys()) == {'path', 'verb', 'status'} self.verb = parsed['verb'] path = parsed['path'] self.path = '/' if path == '/' else path.rstrip('/') self.status = parsed['status'] missing_paths = ['/favicon.ico', '/does-not-exist'] if self.path in missing_paths: assert self.status == http.client.NOT_FOUND # 404 else: expected_http_statuses = [ http.client.OK, # 200 http.client.FOUND, # 302 http.client.UNAUTHORIZED # 401 ] assert self.status in expected_http_statuses
def __init__(self, data): super().__init__(data) try: parsed = json.loads(data) except ValueError: raise testprocess.InvalidLine(data) assert isinstance(parsed, dict) assert set(parsed.keys()) == {'path', 'verb', 'status'} self.verb = parsed['verb'] path = parsed['path'] self.path = '/' if path == '/' else path.rstrip('/') self.status = parsed['status'] self._check_status()
def __init__(self, data): super().__init__(data) match = self.LOG_RE.match(data) if match is None: raise testprocess.InvalidLine(data) self.timestamp = datetime.datetime.strptime(match.group('timestamp'), '%H:%M:%S') loglevel = match.group('loglevel') if loglevel == 'VDEBUG': self.loglevel = log.VDEBUG_LEVEL else: self.loglevel = getattr(logging, loglevel) self.category = match.group('category') module = match.group('module') if module == 'Unknown module': self.module = None else: self.module = module function = match.group('function') if function == 'none': self.function = None else: self.function = function.strip('"') line = int(match.group('line')) if self.function is None and line == 0: self.line = None else: self.line = line msg_match = re.match(r'^(\[(?P<prefix>\d+s ago)\] )?(?P<message>.*)', match.group('message')) self.prefix = msg_match.group('prefix') self.message = msg_match.group('message') self.expected = is_ignored_qt_message(self.message)
def __init__(self, data): super().__init__(data) try: parsed = json.loads(data) except ValueError: raise testprocess.InvalidLine(data) assert isinstance(parsed, dict) assert set(parsed.keys()) == {'path', 'verb', 'status'} self.verb = parsed['verb'] path = parsed['path'] self.path = '/' if path == '/' else path.rstrip('/') self.status = parsed['status'] missing_paths = ['/favicon.ico', '/does-not-exist'] if self.path in missing_paths: assert self.status == 404 else: assert self.status < 400