"""Tests for running more than one account in a single run. Names become directory names, so most of these are about refusing one that would resolve somewhere other than where it reads: `..`, an absolute path, and the trailing dot Win32 strips but Python's normalisation does not. The rest cover the run loop, where one account failing used to end the batch and take the remaining accounts with it. None of these need a browser. The last case does, and starts Edge twice to show that two profiles hold two independent, persistent identities, so it is opt in: python -m unittest discover -s tests REWARDS_BROWSER_TESTS=1 python -m unittest discover -s tests """ import logging import os import shutil import sys import unittest sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src")) from selenium.common.exceptions import ( NoSuchDriverException, SessionNotCreatedException, WebDriverException, ) import accounts import main from constants import USER_DATA_DIR # Names that have to be refused, with the reason each one is not simply a # directory sitting under data-dir. REFUSED_NAMES = [ # relative traversal "..", ".", "../escape", "..\\escape", "a/b", "a\\b", # absolute, drive relative and UNC "/etc", "\\", "/", "C:", "C:\\Windows", "\\\\server\\share", # expanded by a shell somewhere else, not here "~", "%TEMP%", "$HOME", # Win32 strips a trailing dot from a path component and Python does not, so # "personal." is the "personal" directory and "..." is data-dir itself "...", "....", "personal.", "personal..", # shell and filesystem metacharacters "a b", "a:b", "a;b", "a|b", "a*b", "a?b", "a