# Path: internetarchive/exceptions.py
# class AuthenticationError(Exception):
#     """Authentication Failed"""


import contextlib
import os
import pytest
import responses
import requests.adapters
import tempfile
import internetarchive.config
import internetarchive.session
from unittest import mock
from internetarchive.exceptions import AuthenticationError
def test_parse_config_file_existing_config_ia_and_dotia():
    _test_parse_config_file(
        expected_result=('$TMPTESTDIR/.config/ia.ini', False),
        config_file_paths=['$TMPTESTDIR/.config/ia.ini', '$TMPTESTDIR/.ia'],
    )


def test_parse_config_file_existing_all():
    _test_parse_config_file(
        expected_result=('$TMPTESTDIR/.config/internetarchive/ia.ini', True),
        config_file_paths=[
            '$TMPTESTDIR/.config/internetarchive/ia.ini',
            '$TMPTESTDIR/.config/ia.ini',
            '$TMPTESTDIR/.ia'
        ],
    )


def test_parse_config_file_custom_xdg():
    _test_parse_config_file(
        expected_result=('$TMPTESTDIR/.xdg/internetarchive/ia.ini', True),
        xdg_config_home='$TMPTESTDIR/.xdg',
    )


def test_parse_config_file_empty_xdg():
    # Empty XDG_CONFIG_HOME should be treated as if not set, i.e. default
    _test_parse_config_file(
        expected_result=('$TMPTESTDIR/.config/internetarchive/ia.ini', True),
        xdg_config_home='',

# Path: internetarchive/exceptions.py
# class AuthenticationError(Exception):
#     """Authentication Failed"""


# Path: tests/test_config.py
import contextlib
import os
import pytest
import responses
import requests.adapters
import tempfile
import internetarchive.config
import internetarchive.session
from unittest import mock
from internetarchive.exceptions import AuthenticationError

def test_parse_config_file_existing_config_ia_and_dotia():
    _test_parse_config_file(
        expected_result=('$TMPTESTDIR/.config/ia.ini', False),
        config_file_paths=['$TMPTESTDIR/.config/ia.ini', '$TMPTESTDIR/.ia'],
    )


def test_parse_config_file_existing_all():
    _test_parse_config_file(
        expected_result=('$TMPTESTDIR/.config/internetarchive/ia.ini', True),
        config_file_paths=[
            '$TMPTESTDIR/.config/internetarchive/ia.ini',
            '$TMPTESTDIR/.config/ia.ini',
            '$TMPTESTDIR/.ia'
        ],
    )


def test_parse_config_file_custom_xdg():
    _test_parse_config_file(
        expected_result=('$TMPTESTDIR/.xdg/internetarchive/ia.ini', True),
        xdg_config_home='$TMPTESTDIR/.xdg',
    )


def test_parse_config_file_empty_xdg():
    # Empty XDG_CONFIG_HOME should be treated as if not set, i.e. default
    _test_parse_config_file(
        expected_result=('$TMPTESTDIR/.config/internetarchive/ia.ini', True),
        xdg_config_home='',

    )