def setUp(self): super().setUp() tls_cert, tls_key = create_tls_cert("127.0.0.1") self.tls_cert_file = NamedTemporaryFile(delete=False) self.tls_key_file = NamedTemporaryFile(delete=False) with open(self.tls_cert_file.name, "w") as f: f.write(tls_cert.decode()) with open(self.tls_key_file.name, "w") as f: f.write(tls_key.decode()) parser = get_parser(default_config_files=[]) options = parser.parse_args([ "--tls-cert", self.tls_cert_file.name, "--tls-key", self.tls_key_file.name, ]) self.runner = Runner(self.environment) self.stats = self.runner.stats self.web_ui = self.environment.create_web_ui("127.0.0.1", 0, tls_cert=options.tls_cert, tls_key=options.tls_key) gevent.sleep(0.01) self.web_port = self.web_ui.server.server_port
def setUp(self): super().setUp() parser = get_parser(default_config_files=[]) options = parser.parse_args(["--web-auth", "john:doe"]) self.runner = Runner(self.environment) self.stats = self.runner.stats self.web_ui = self.environment.create_web_ui("127.0.0.1", 0, auth_credentials=options.web_auth) self.web_ui.app.view_functions["request_stats"].clear_cache() gevent.sleep(0.01) self.web_port = self.web_ui.server.server_port