import os from helpers.integrations.secrets_manager import SecretsManagerClient class TestUser: def __init__(self, username: str, password: str, **kwargs): self.username = username self.password = password def get_test_user(platform: str, brand: str, user_type: str = 'client') -> TestUser: if not platform or not brand: raise ValueError('Both OS and BRAND variables must be set') users = { 'ios': {'client': {'orchard': '111380', 'awal': '207065', 'sme': '516899'}, 'employee': {'orchard': '662661', 'awal': None, 'sme': None}}, 'android': {'client': {'orchard': '513507', 'awal': '943132', 'sme': '638874'}, 'employee': {'orchard': None, 'awal': '177396', 'sme': None}} } secrets_client = SecretsManagerClient() secret_path = ( f"{os.getenv('CONFIG_ENV', 'qa')}/" "e2e-test-secrets/user-data/insights-user-data" ) user_data = secrets_client.get_secret_json(secret_path) try: user_id = users[platform.lower()][user_type.lower()][brand.lower()] except KeyError: raise ValueError( f'Unsupported combination: platform={platform}, ' f'brand={brand}, user_type={user_type}' ) # Check if user_id is None (unsupported combination) if user_id is None: raise ValueError( f'User type "{user_type}" is not available for {brand.upper()} ' f'on {platform.upper()}.' ) user_info = user_data['insights'][user_id] return TestUser( username=user_info['username'], password=user_info['password'], )