# Path: userprofiles/settings.py
# def validate_settings():
#     if (up_settings.USE_ACCOUNT_VERIFICATION and
#             'userprofiles.contrib.accountverification' not in settings.INSTALLED_APPS):
#         raise ImproperlyConfigured('You need to add `userprofiles.contrib.accountverification` '
#             'to INSTALLED_APPS to use account verification.')
# 
#     # These settings together make no sense
#     if up_settings.USE_ACCOUNT_VERIFICATION and up_settings.AUTO_LOGIN:
#         raise ImproperlyConfigured("You cannot use autologin with account verification")
# 
#     if up_settings.USE_PROFILE and 'userprofiles.contrib.profiles' not in settings.INSTALLED_APPS:
#         raise ImproperlyConfigured('You need to add `userprofiles.contrib.profiles` '
#             'to INSTALLED_APPS to use profiles.')
# 
#     if up_settings.PROFILE_ALLOW_EMAIL_CHANGE and up_settings.CHECK_UNIQUE_EMAIL:
#         raise ImproperlyConfigured(
#             'USERPROFILES_PROFILE_ALLOW_EMAIL_CHANGE cannot be activated '
#             'when USERPROFILES_CHECK_UNIQUE_EMAIL is active.')
# 
#     if (up_settings.USE_EMAIL_VERIFICATION and
#             'userprofiles.contrib.emailverification' not in settings.INSTALLED_APPS):
#         raise ImproperlyConfigured('You need to add `userprofiles.contrib.emailverification` '
#             'to INSTALLED_APPS to use emailverification.')
# 
#     if up_settings.PROFILE_ALLOW_EMAIL_CHANGE and up_settings.USE_EMAIL_VERIFICATION:
#         raise ImproperlyConfigured(
#             'USERPROFILES_PROFILE_ALLOW_EMAIL_CHANGE cannot be activated '
#             'when USERPROFILES_USE_EMAIL_VERIFICATION is activated.')
# 
#     if ('test' not in sys.argv and not up_settings.USE_EMAIL_VERIFICATION and
#             'userprofiles.contrib.emailverification' in settings.INSTALLED_APPS):
#         raise ImproperlyConfigured('You need to set USERPROFILES_USE_EMAIL_VERIFICATION '
#             'to use `userprofiles.contrib.emailverification`')


from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.test.utils import override_settings
from userprofiles.settings import validate_settings



class SettingsTests(TestCase):
    @override_settings(USERPROFILES_USE_ACCOUNT_VERIFICATION=True,
        INSTALLED_APPS=list(set(settings.INSTALLED_APPS) - set(
            ['userprofiles.contrib.accountverification'])))
    def test_account_verification(self):
        self.assertRaises(ImproperlyConfigured, validate_settings)

    @override_settings(USERPROFILES_USE_ACCOUNT_VERIFICATION=True,
        USERPROFILES_AUTO_LOGIN=True)
    def test_account_verification_auto_login(self):
        self.assertRaises(ImproperlyConfigured, validate_settings)

    @override_settings(USERPROFILES_USE_PROFILE=True,
        INSTALLED_APPS=list(set(settings.INSTALLED_APPS) - set(
            ['userprofiles.contrib.profiles'])))
    def test_profile(self):
        self.assertRaises(ImproperlyConfigured, validate_settings)

    @override_settings(USERPROFILES_PROFILE_ALLOW_EMAIL_CHANGE=True,
        USERPROFILES_CHECK_UNIQUE_EMAIL=True)
    def test_profile_email_check(self):

# Path: userprofiles/settings.py
# def validate_settings():
#     if (up_settings.USE_ACCOUNT_VERIFICATION and
#             'userprofiles.contrib.accountverification' not in settings.INSTALLED_APPS):
#         raise ImproperlyConfigured('You need to add `userprofiles.contrib.accountverification` '
#             'to INSTALLED_APPS to use account verification.')
# 
#     # These settings together make no sense
#     if up_settings.USE_ACCOUNT_VERIFICATION and up_settings.AUTO_LOGIN:
#         raise ImproperlyConfigured("You cannot use autologin with account verification")
# 
#     if up_settings.USE_PROFILE and 'userprofiles.contrib.profiles' not in settings.INSTALLED_APPS:
#         raise ImproperlyConfigured('You need to add `userprofiles.contrib.profiles` '
#             'to INSTALLED_APPS to use profiles.')
# 
#     if up_settings.PROFILE_ALLOW_EMAIL_CHANGE and up_settings.CHECK_UNIQUE_EMAIL:
#         raise ImproperlyConfigured(
#             'USERPROFILES_PROFILE_ALLOW_EMAIL_CHANGE cannot be activated '
#             'when USERPROFILES_CHECK_UNIQUE_EMAIL is active.')
# 
#     if (up_settings.USE_EMAIL_VERIFICATION and
#             'userprofiles.contrib.emailverification' not in settings.INSTALLED_APPS):
#         raise ImproperlyConfigured('You need to add `userprofiles.contrib.emailverification` '
#             'to INSTALLED_APPS to use emailverification.')
# 
#     if up_settings.PROFILE_ALLOW_EMAIL_CHANGE and up_settings.USE_EMAIL_VERIFICATION:
#         raise ImproperlyConfigured(
#             'USERPROFILES_PROFILE_ALLOW_EMAIL_CHANGE cannot be activated '
#             'when USERPROFILES_USE_EMAIL_VERIFICATION is activated.')
# 
#     if ('test' not in sys.argv and not up_settings.USE_EMAIL_VERIFICATION and
#             'userprofiles.contrib.emailverification' in settings.INSTALLED_APPS):
#         raise ImproperlyConfigured('You need to set USERPROFILES_USE_EMAIL_VERIFICATION '
#             'to use `userprofiles.contrib.emailverification`')


# Path: userprofiles/tests/test_settings.py
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.test.utils import override_settings
from userprofiles.settings import validate_settings




class SettingsTests(TestCase):
    @override_settings(USERPROFILES_USE_ACCOUNT_VERIFICATION=True,
        INSTALLED_APPS=list(set(settings.INSTALLED_APPS) - set(
            ['userprofiles.contrib.accountverification'])))
    def test_account_verification(self):
        self.assertRaises(ImproperlyConfigured, validate_settings)

    @override_settings(USERPROFILES_USE_ACCOUNT_VERIFICATION=True,
        USERPROFILES_AUTO_LOGIN=True)
    def test_account_verification_auto_login(self):
        self.assertRaises(ImproperlyConfigured, validate_settings)

    @override_settings(USERPROFILES_USE_PROFILE=True,
        INSTALLED_APPS=list(set(settings.INSTALLED_APPS) - set(
            ['userprofiles.contrib.profiles'])))
    def test_profile(self):
        self.assertRaises(ImproperlyConfigured, validate_settings)

    @override_settings(USERPROFILES_PROFILE_ALLOW_EMAIL_CHANGE=True,
        USERPROFILES_CHECK_UNIQUE_EMAIL=True)
    def test_profile_email_check(self):

        self.assertRaises(ImproperlyConfigured, validate_settings)