except: response['body']['string'] = gzip_string(decompressed.replace(settings.USERNAME, TESTING_USERNAME)) return response if 'screenname' not in response_dict: return response if response_dict['screenname'] is not None: response_dict['screenname'] = TESTING_USERNAME response_dict['userid'] = 1 response_dict['thumbnail'] = '' response['body']['string'] = gzip_string(simplejson.dumps(response_dict)) return response before_record = util.compose(scrub_request_body, remove_headers(headers_to_remove=('Set-Cookie', 'Cookie'))) def match_search_query(left, right): left_filter = set([value for param_name, value in left.query if 'filter' in param_name]) right_filter = set([value for param_name, value in right.query if 'filter' in param_name]) left_rest = set([(param_name, value) for param_name, value in left.query if 'filter' not in param_name]) right_rest = set([(param_name, value) for param_name, value in right.query if 'filter' not in param_name]) return left_filter == right_filter and left_rest == right_rest
should_recompress = False else: should_recompress = True body = replace_json_fields(body) body = util.replace_all_case_insensitive(body, settings.USERNAME, TESTING_USERNAME) if should_recompress: body = gzip_string(body) response['body']['string'] = body return response before_record = check_should_scrub( util.compose(scrub_request_body, remove_headers(headers_to_remove=('Set-Cookie', 'Cookie')))) def _maybe_decode(maybe_bytes): try: return maybe_bytes.decode('utf-8') except (AttributeError, UnicodeDecodeError): return maybe_bytes def _match_search_query(left, right): left_filter = set([ value for param_name, value in left if 'filter' in _maybe_decode(param_name) ]) right_filter = set([