# Path: account/models.py
# class UserProfile(models.Model):
#     user = models.OneToOneField(User)
#     profile_picture = models.ImageField(upload_to=user_profile_picture, null=True, blank=True)
#     description = models.TextField(null=True, blank=True)
#     roll_number = models.CharField(max_length=16, null=True, blank=True)
#     type = models.CharField(max_length=16, null=True, blank=True)
#     mobile = models.CharField(max_length=16, null=True, blank=True)
#     is_alumni = models.BooleanField(default=False)
#     sex = models.CharField(max_length=10, choices=SEXES, null=True, blank=True)
#     _history_ = HistoricalRecords()
# 
#     def __str__(self):
#         return self.user.username
# 
# def user_profile_picture(instance, filename):  # pylint: disable=unused-argument
#     filename = filename.split('.')
#     if len(filename) > 1:
#         ext = filename[-1]
#     else:
#         ext = "png"
#     return os.path.join("profile_picture", uuid4().hex + "." + ext)


import django.utils.six as six
from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase, mock
from .models import UserProfile, user_profile_picture
    from urllib.parse import quote_plus
    from urllib import quote_plus


try:
except ImportError:




class LoginViewTestCase(TestCase):
    login_url = reverse('account:login')
    login_redirect_url = reverse(settings.LOGIN_REDIRECT_URL)
    next_ = reverse('oauth2_provider:list')
    template_name = 'account/login.html'

    def setUp(self):
        self.test_user = User.objects.create_user(username='test_user', password='test123')
        self.userprofile = UserProfile.objects.create(user=self.test_user)

    def tearDown(self):
        self.client.logout()
        self.test_user.delete()

    def test_userprofile_unicode(self):
        self.assertEqual(str(self.userprofile), self.test_user.username)

    def test_application_logo_upload(self):
        with mock.patch('uuid.uuid4') as uuid_mock:
            uuid_mock.return_value = '1234567890'

# Path: account/models.py
# class UserProfile(models.Model):
#     user = models.OneToOneField(User)
#     profile_picture = models.ImageField(upload_to=user_profile_picture, null=True, blank=True)
#     description = models.TextField(null=True, blank=True)
#     roll_number = models.CharField(max_length=16, null=True, blank=True)
#     type = models.CharField(max_length=16, null=True, blank=True)
#     mobile = models.CharField(max_length=16, null=True, blank=True)
#     is_alumni = models.BooleanField(default=False)
#     sex = models.CharField(max_length=10, choices=SEXES, null=True, blank=True)
#     _history_ = HistoricalRecords()
# 
#     def __str__(self):
#         return self.user.username
# 
# def user_profile_picture(instance, filename):  # pylint: disable=unused-argument
#     filename = filename.split('.')
#     if len(filename) > 1:
#         ext = filename[-1]
#     else:
#         ext = "png"
#     return os.path.join("profile_picture", uuid4().hex + "." + ext)


# Path: account/tests.py
import django.utils.six as six
from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase, mock
from .models import UserProfile, user_profile_picture
    from urllib.parse import quote_plus
    from urllib import quote_plus



try:
except ImportError:




class LoginViewTestCase(TestCase):
    login_url = reverse('account:login')
    login_redirect_url = reverse(settings.LOGIN_REDIRECT_URL)
    next_ = reverse('oauth2_provider:list')
    template_name = 'account/login.html'

    def setUp(self):
        self.test_user = User.objects.create_user(username='test_user', password='test123')
        self.userprofile = UserProfile.objects.create(user=self.test_user)

    def tearDown(self):
        self.client.logout()
        self.test_user.delete()

    def test_userprofile_unicode(self):
        self.assertEqual(str(self.userprofile), self.test_user.username)

    def test_application_logo_upload(self):
        with mock.patch('uuid.uuid4') as uuid_mock:
            uuid_mock.return_value = '1234567890'

            filename = user_profile_picture(self.test_user, 'hola.png')