def check_for_redirect(self, fileset, uri, dest, query=""): # TODO: Don't require monkey-patching sbrowse.stylesheet = lambda: () def start_response(response_code, headers): self.assertEquals(response_code, "302 OK") self.assertEquals(headers, [("Location", "script_name" + dest)]) environ = {"SCRIPT_NAME": "script_name", "PATH_INFO": uri, "QUERY_STRING": query, "HTTP_HOST": "localhost:8000"} list(sbrowse.handle_request(fileset, environ, start_response))
def get_response(self, fileset, uri, query=""): # TODO: Don't require monkey-patching sbrowse.stylesheet = \ lambda: ['<link rel="stylesheet" href="../styles.css"/>'] def start_response(response_code, headers): self.assertEquals(response_code, "200 OK") environ = {"SCRIPT_NAME": "script_name", "PATH_INFO": uri, "QUERY_STRING": query, "HTTP_HOST": "localhost:8000"} iterable = sbrowse.handle_request(fileset, environ, start_response) return "\n".join(iterable)