# Path: userprofiles/settings.py
# class Settings(object):
#     def __init__(self, **kwargs):
#     def __getattr__(self, key):
# def validate_settings():


from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.utils import override_settings
from userprofiles.settings import up_settings
        self.assertTrue('<input type="hidden" name="username"' in response.content or
            '<input id="id_username" name="username" type="hidden" />' in response.content)

        data = self.data
        data['username'] = ''

        response = self.client.post(url, data=data)
        self.assertEqual(response.status_code, 302)
        self.assertRedirects(response,
                             reverse(up_settings.REGISTRATION_REDIRECT))
        user = User.objects.get(email=data['email'])
        self.assertNotEqual(user.username, self.data['username'])

    @override_settings(USERPROFILES_AUTO_LOGIN=True)
    def test_auto_login(self):
        url = reverse('userprofiles_registration')
        response = self.client.post(url, data=self.data)
        self.assertEqual(response.status_code, 302)
        self.assertRedirects(response,
                             reverse(up_settings.REGISTRATION_REDIRECT))

        user = User.objects.get(username=self.data['username'])
        self.assertTrue(user.is_authenticated())

    @override_settings(USERPROFILES_AUTO_LOGIN=True, USERPROFILES_EMAIL_ONLY=True)
    def test_email_and_auto_login(self):
        url = reverse('userprofiles_registration')
        response = self.client.post(url, data=self.data)
        self.assertEqual(response.status_code, 302)
        self.assertRedirects(response,

# Path: userprofiles/settings.py
# class Settings(object):
#     def __init__(self, **kwargs):
#     def __getattr__(self, key):
# def validate_settings():


# Path: userprofiles/tests/test_views.py
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.utils import override_settings
from userprofiles.settings import up_settings

        self.assertTrue('<input type="hidden" name="username"' in response.content or
            '<input id="id_username" name="username" type="hidden" />' in response.content)

        data = self.data
        data['username'] = ''

        response = self.client.post(url, data=data)
        self.assertEqual(response.status_code, 302)
        self.assertRedirects(response,
                             reverse(up_settings.REGISTRATION_REDIRECT))
        user = User.objects.get(email=data['email'])
        self.assertNotEqual(user.username, self.data['username'])

    @override_settings(USERPROFILES_AUTO_LOGIN=True)
    def test_auto_login(self):
        url = reverse('userprofiles_registration')
        response = self.client.post(url, data=self.data)
        self.assertEqual(response.status_code, 302)
        self.assertRedirects(response,
                             reverse(up_settings.REGISTRATION_REDIRECT))

        user = User.objects.get(username=self.data['username'])
        self.assertTrue(user.is_authenticated())

    @override_settings(USERPROFILES_AUTO_LOGIN=True, USERPROFILES_EMAIL_ONLY=True)
    def test_email_and_auto_login(self):
        url = reverse('userprofiles_registration')
        response = self.client.post(url, data=self.data)
        self.assertEqual(response.status_code, 302)
        self.assertRedirects(response,

                             reverse(up_settings.REGISTRATION_REDIRECT))