def test_routing(self): # Make different uris paths = list(set(rand_strings(30))) def client(): for i, path in enumerate(paths): uri = f"http://localhost:{8000 + i}/{path}" with http.get(uri) as res: self.assertEqual(res.body, IDEAL_RESNPONSE) forms = [] for i, path in enumerate(paths): app = WSGIApp() app.route(path)(MockEndpoint) forms.append(WSGIServerForm("", 8000 + i, app, PATH_SERVER_LOG)) WSGITestExecutor(*forms).exec(client)
def make_repo_branch(username: str, repository: str) -> WSGIApp: branch = WSGIApp() # Add endpoints required for fetching and pushing a remote repository. branch.route(username, repository, "info", "refs")(HandshakeEndpoint) branch.route(username, repository, ServiceLiterals.RECEIVE_PACK)(UploadEndpoint) branch.route(username, repository, ServiceLiterals.UPLOAD_PACK)(DownloadEndpoint) return branch