Loading load_check.py +38 −29 Original line number Diff line number Diff line Loading @@ -34,42 +34,20 @@ class MultipleTest(unittest.TestCase): print("EMS 접속이 원할하지 않습니다. 프로그램을 종료합니다") sys.exit(1) # A list is created to store multiple account configurations. self.account_configs = [] # print("\n[필수 입력] 계정 정보를 한 줄씩 입력하세요. (포맷: 유형 / 아이디, 비번 / 세션 수)") print("\n3. [필수 입력] 계정유형(1-어드민,2-(지역)관리자,3-사용자) / 계정 접속정보 / 커넥션 비중") print("ex) 1 / admin, admin / 3") print("ex) 2 / watchall, watchall / 3") print("ex) 3 / monitor, monitor / 4") print("입력을 마치려면 빈 줄에서 엔터키를 누르세요.") print("형식 예시: 1 / admin, admin / 3") print("한 줄만 입력하세요. (빈 줄은 허용되지 않음)") # A loop reads each line of input until an empty line is entered. while True: user_input = input("").strip() if not user_input: # Exit the loop if the input is empty. if not self.account_configs: print("입력된 계정 정보가 없습니다. 프로그램을 종료합니다.") sys.exit(1) break try: # Each line is parsed and appended to the list as a dictionary. parts = user_input.split(' / ') account_type = int(parts[0].strip()) credentials = parts[1].split(',') username = credentials[0].strip() password = credentials[1].strip() duplicate_count = int(parts[2].strip()) config = { "account_type": account_type, "username": username, "password": password, "duplicate_count": duplicate_count } config = self._parse_account_line(user_input) self.account_configs.append(config) except (ValueError, IndexError): print(f"잘못된 입력 형식입니다: '{user_input}'. 해당 줄은 무시됩니다.") # success -> stop re-prompting break except ValueError as e: print(f"입력 형식 오류: {e}. 다시 입력하세요.") # New inputs for connection management print("\n4. [선택] 테스트 유형(기본값: 일반접속): 일반 접속(1), 일시 접속(2), 부하 화면 접근(3)") Loading Loading @@ -119,6 +97,37 @@ class MultipleTest(unittest.TestCase): else: print("[INFO] Default mode: saving screenshots only for first and last drivers.") def _parse_account_line(self, user_input: str): """Parse a single account config line in the format: '<type> / username, password / duplicate_count' Returns a dict on success or raises ValueError on bad format. """ if not user_input or not user_input.strip(): raise ValueError("빈 입력입니다. 입력을 반복합니다.") parts = user_input.split(' / ') if len(parts) < 3: raise ValueError("입력 형식이 잘못되었습니다. 예시: 1 / admin, admin / 3") try: account_type = int(parts[0].strip()) credentials = parts[1].split(',') if len(credentials) < 2: raise ValueError("아이디와 비밀번호를 쉼표로 구분하세요. 예시: admin, admin") username = credentials[0].strip() password = credentials[1].strip() duplicate_count = int(parts[2].strip()) except ValueError as e: # Preserve the original exception context for better debugging and satisfy pylint W0707 raise ValueError(f"입력 형식 오류: {e}") from e return { "account_type": account_type, "username": username, "password": password, "duplicate_count": duplicate_count } def check_http_status(self, url: str, max_retry: int = 3, ignore_cert: bool = True) -> bool: """ Checks the HTTP status of the given URL. Loading Loading
load_check.py +38 −29 Original line number Diff line number Diff line Loading @@ -34,42 +34,20 @@ class MultipleTest(unittest.TestCase): print("EMS 접속이 원할하지 않습니다. 프로그램을 종료합니다") sys.exit(1) # A list is created to store multiple account configurations. self.account_configs = [] # print("\n[필수 입력] 계정 정보를 한 줄씩 입력하세요. (포맷: 유형 / 아이디, 비번 / 세션 수)") print("\n3. [필수 입력] 계정유형(1-어드민,2-(지역)관리자,3-사용자) / 계정 접속정보 / 커넥션 비중") print("ex) 1 / admin, admin / 3") print("ex) 2 / watchall, watchall / 3") print("ex) 3 / monitor, monitor / 4") print("입력을 마치려면 빈 줄에서 엔터키를 누르세요.") print("형식 예시: 1 / admin, admin / 3") print("한 줄만 입력하세요. (빈 줄은 허용되지 않음)") # A loop reads each line of input until an empty line is entered. while True: user_input = input("").strip() if not user_input: # Exit the loop if the input is empty. if not self.account_configs: print("입력된 계정 정보가 없습니다. 프로그램을 종료합니다.") sys.exit(1) break try: # Each line is parsed and appended to the list as a dictionary. parts = user_input.split(' / ') account_type = int(parts[0].strip()) credentials = parts[1].split(',') username = credentials[0].strip() password = credentials[1].strip() duplicate_count = int(parts[2].strip()) config = { "account_type": account_type, "username": username, "password": password, "duplicate_count": duplicate_count } config = self._parse_account_line(user_input) self.account_configs.append(config) except (ValueError, IndexError): print(f"잘못된 입력 형식입니다: '{user_input}'. 해당 줄은 무시됩니다.") # success -> stop re-prompting break except ValueError as e: print(f"입력 형식 오류: {e}. 다시 입력하세요.") # New inputs for connection management print("\n4. [선택] 테스트 유형(기본값: 일반접속): 일반 접속(1), 일시 접속(2), 부하 화면 접근(3)") Loading Loading @@ -119,6 +97,37 @@ class MultipleTest(unittest.TestCase): else: print("[INFO] Default mode: saving screenshots only for first and last drivers.") def _parse_account_line(self, user_input: str): """Parse a single account config line in the format: '<type> / username, password / duplicate_count' Returns a dict on success or raises ValueError on bad format. """ if not user_input or not user_input.strip(): raise ValueError("빈 입력입니다. 입력을 반복합니다.") parts = user_input.split(' / ') if len(parts) < 3: raise ValueError("입력 형식이 잘못되었습니다. 예시: 1 / admin, admin / 3") try: account_type = int(parts[0].strip()) credentials = parts[1].split(',') if len(credentials) < 2: raise ValueError("아이디와 비밀번호를 쉼표로 구분하세요. 예시: admin, admin") username = credentials[0].strip() password = credentials[1].strip() duplicate_count = int(parts[2].strip()) except ValueError as e: # Preserve the original exception context for better debugging and satisfy pylint W0707 raise ValueError(f"입력 형식 오류: {e}") from e return { "account_type": account_type, "username": username, "password": password, "duplicate_count": duplicate_count } def check_http_status(self, url: str, max_retry: int = 3, ignore_cert: bool = True) -> bool: """ Checks the HTTP status of the given URL. Loading