# Path: binstar_client/utils/config.py
# def expandvars(path):
# def expand(path):
# def recursive_update(config, update_dict):
# def get_server_api(token=None, site=None, cls=None, config=None, **kwargs):
# def get_binstar(args=None, cls=None):
# def store_token(token, args):
# def load_token(url):
# def remove_token(args):
# def load_config(config_file):
# def load_file_configs(search_path):
#     def _file_yaml_loader(fullpath):
#     def _dir_yaml_loader(fullpath):
#     def _get_st_mode(path):
# def get_config(site=None):
# def save_config(data, config_file):
# def set_config(data, user=True):
#     USER_CONFIG = join(dirs.user_data_dir, 'config.yaml')
#     USER_CONFIG = expand('~/.continuum/anaconda-client/config.yaml')
# PACKAGE_TYPES = {
#     'env': 'Environment',
#     'ipynb': 'Notebook',
#     'conda' : 'Conda Package',
#     'pypi': 'Python Package',
# }
# USER_LOGDIR = dirs.user_log_dir
# SITE_CONFIG = expand('$CONDA_ROOT/etc/anaconda-client/config.yaml')
# SYSTEM_CONFIG = SITE_CONFIG
# DEFAULT_URL = 'https://api.anaconda.org'
# DEFAULT_CONFIG = {
#     'sites': {
#         'anaconda': {'url': DEFAULT_URL},
#         'binstar': {'url': DEFAULT_URL},
#     },
#     'auto_register': True,
#     'default_site': None,
#     'url': DEFAULT_URL,
#     'ssl_verify': True
# }
# CONFIGURATION_KEYS = [
#     'auto_register',
#     'default_site',
#     'upload_user',
#     'sites',
#     'url',
#     'verify_ssl',
#     'ssl_verify',
# ]
# SEARCH_PATH = (
#     dirs.site_data_dir,
#     '/etc/anaconda-client/',
#     '$CONDA_ROOT/etc/anaconda-client/',
#     dirs.user_data_dir,
#     '~/.continuum/anaconda-client/',
#     '$CONDA_PREFIX/etc/anaconda-client/',
# )
# TOKEN_DIRS = [
#     dirs.user_data_dir,
#     join(dirname(USER_CONFIG), 'tokens'),
# ]
# TOKEN_DIR = TOKEN_DIRS[-1]


from os.path import join
from binstar_client.utils import config
import os
import shutil
import tempfile
import unittest
import mock
        os.mkdir(system_dir)
        os.mkdir(user_dir)
        return user_dir, system_dir

    def test_defaults(self):
        user_dir, system_dir = self.create_config_dirs()
        with open(join(user_dir, 'config.yaml'), 'wb') as fd:
            fd.write(b'')

        with mock.patch('binstar_client.utils.config.SEARCH_PATH',
                        [system_dir, user_dir]):
            cfg = config.get_config()
            self.assertEqual(cfg, config.DEFAULT_CONFIG)

    def test_global_url(self):
        """
        Test regression reported on:

        https://github.com/Anaconda-Platform/anaconda-client/issues/464
        """
        user_dir, system_dir = self.create_config_dirs()
        with open(join(user_dir, 'config.yaml'), 'wb') as fd:
            fd.write(b'')

        url_data = {'url': 'https://blob.org'}
        config_data = config.DEFAULT_CONFIG.copy()
        config_data.update(url_data)

        with mock.patch('binstar_client.utils.config.SEARCH_PATH',
                        [system_dir, user_dir]):

# Path: binstar_client/utils/config.py
# def expandvars(path):
# def expand(path):
# def recursive_update(config, update_dict):
# def get_server_api(token=None, site=None, cls=None, config=None, **kwargs):
# def get_binstar(args=None, cls=None):
# def store_token(token, args):
# def load_token(url):
# def remove_token(args):
# def load_config(config_file):
# def load_file_configs(search_path):
#     def _file_yaml_loader(fullpath):
#     def _dir_yaml_loader(fullpath):
#     def _get_st_mode(path):
# def get_config(site=None):
# def save_config(data, config_file):
# def set_config(data, user=True):
#     USER_CONFIG = join(dirs.user_data_dir, 'config.yaml')
#     USER_CONFIG = expand('~/.continuum/anaconda-client/config.yaml')
# PACKAGE_TYPES = {
#     'env': 'Environment',
#     'ipynb': 'Notebook',
#     'conda' : 'Conda Package',
#     'pypi': 'Python Package',
# }
# USER_LOGDIR = dirs.user_log_dir
# SITE_CONFIG = expand('$CONDA_ROOT/etc/anaconda-client/config.yaml')
# SYSTEM_CONFIG = SITE_CONFIG
# DEFAULT_URL = 'https://api.anaconda.org'
# DEFAULT_CONFIG = {
#     'sites': {
#         'anaconda': {'url': DEFAULT_URL},
#         'binstar': {'url': DEFAULT_URL},
#     },
#     'auto_register': True,
#     'default_site': None,
#     'url': DEFAULT_URL,
#     'ssl_verify': True
# }
# CONFIGURATION_KEYS = [
#     'auto_register',
#     'default_site',
#     'upload_user',
#     'sites',
#     'url',
#     'verify_ssl',
#     'ssl_verify',
# ]
# SEARCH_PATH = (
#     dirs.site_data_dir,
#     '/etc/anaconda-client/',
#     '$CONDA_ROOT/etc/anaconda-client/',
#     dirs.user_data_dir,
#     '~/.continuum/anaconda-client/',
#     '$CONDA_PREFIX/etc/anaconda-client/',
# )
# TOKEN_DIRS = [
#     dirs.user_data_dir,
#     join(dirname(USER_CONFIG), 'tokens'),
# ]
# TOKEN_DIR = TOKEN_DIRS[-1]


# Path: binstar_client/utils/test/test_config.py
from os.path import join
from binstar_client.utils import config
import os
import shutil
import tempfile
import unittest
import mock

        os.mkdir(system_dir)
        os.mkdir(user_dir)
        return user_dir, system_dir

    def test_defaults(self):
        user_dir, system_dir = self.create_config_dirs()
        with open(join(user_dir, 'config.yaml'), 'wb') as fd:
            fd.write(b'')

        with mock.patch('binstar_client.utils.config.SEARCH_PATH',
                        [system_dir, user_dir]):
            cfg = config.get_config()
            self.assertEqual(cfg, config.DEFAULT_CONFIG)

    def test_global_url(self):
        """
        Test regression reported on:

        https://github.com/Anaconda-Platform/anaconda-client/issues/464
        """
        user_dir, system_dir = self.create_config_dirs()
        with open(join(user_dir, 'config.yaml'), 'wb') as fd:
            fd.write(b'')

        url_data = {'url': 'https://blob.org'}
        config_data = config.DEFAULT_CONFIG.copy()
        config_data.update(url_data)

        with mock.patch('binstar_client.utils.config.SEARCH_PATH',
                        [system_dir, user_dir]):

            config.save_config(url_data, join(user_dir, 'config.yaml'))