# Path: core/models.py
# class Profile(models.Model):
#     language = models.CharField(
#         _('Language'), choices=settings.LANGUAGES,
#         max_length=50, null=True, blank=False)
#     about_me = models.TextField(
#         _('About me'), max_length=500, null=True, blank=True)
#     github = models.CharField(
#         _('Github username'), max_length=50, null=True, blank=True)
#     facebook = models.CharField(
#         _('Facebook username'), max_length=50, null=True, blank=True)
#     twitter = models.CharField(
#         _('Twitter username'), max_length=50, null=True, blank=True)
#     site = models.URLField(
#         _('Site url'), max_length=200, null=True, blank=True)
#     image = models.ImageField(null=True, blank=True)
# 
#     # relations
#     user = models.OneToOneField(to=settings.AUTH_USER_MODEL)
# 
#     class Meta:
#         verbose_name = _('Profile')
# 
#     def __str__(self):
#         return self.user.get_full_name()
# 
#     def get_absolute_url(self):
#         return reverse_lazy(
#             'user_profile', kwargs={'user__username': self.user.username})
# 
#     def get_github_url(self):
#         if self.github:
#             return 'https://github.com/{}'.format(self.github)
# 
#     def get_facebook_url(self):
#         if self.facebook:
#             return 'https://facebook.com/{}'.format(self.facebook)
# 
#     def get_twitter_url(self):
#         if self.twitter:
#             return 'https://twitter.com/{}'.format(self.twitter)
# 
#     def get_site_url(self):
#         return self.site
# 
#     def get_profile_events(self):
#         return self.user.events.filter(is_published=True)
# 
#     def get_profile_proposals(self):
#         return Proposal.objects.filter(
#             author=self.user,
#             event__is_published=True,
#             event__anonymous_voting=False,
#             is_published=True,
#         )


from django.contrib.auth import get_user_model
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
from django.utils import timezone
from django.utils.translation import get_language
from model_mommy import mommy
from core.models import Profile
# coding: utf-8




class AboutViewTest(TestCase):
    def setUp(self):
        self.resp = self.client.get('/about/')

    def test_get(self):
        'GET /about/ must return status code 200'
        self.assertEqual(200, self.resp.status_code)

    def test_template(self):
        'About page must use about.html'
        self.assertTemplateUsed(self.resp, 'about.html')


class ProfileUpdateTest(TestCase):
    fixtures = ['user.json', 'event.json', 'proposal.json']

    def setUp(self):
        self.client = Client()
        self.client.login(username='user', password='user')


# Path: core/models.py
# class Profile(models.Model):
#     language = models.CharField(
#         _('Language'), choices=settings.LANGUAGES,
#         max_length=50, null=True, blank=False)
#     about_me = models.TextField(
#         _('About me'), max_length=500, null=True, blank=True)
#     github = models.CharField(
#         _('Github username'), max_length=50, null=True, blank=True)
#     facebook = models.CharField(
#         _('Facebook username'), max_length=50, null=True, blank=True)
#     twitter = models.CharField(
#         _('Twitter username'), max_length=50, null=True, blank=True)
#     site = models.URLField(
#         _('Site url'), max_length=200, null=True, blank=True)
#     image = models.ImageField(null=True, blank=True)
# 
#     # relations
#     user = models.OneToOneField(to=settings.AUTH_USER_MODEL)
# 
#     class Meta:
#         verbose_name = _('Profile')
# 
#     def __str__(self):
#         return self.user.get_full_name()
# 
#     def get_absolute_url(self):
#         return reverse_lazy(
#             'user_profile', kwargs={'user__username': self.user.username})
# 
#     def get_github_url(self):
#         if self.github:
#             return 'https://github.com/{}'.format(self.github)
# 
#     def get_facebook_url(self):
#         if self.facebook:
#             return 'https://facebook.com/{}'.format(self.facebook)
# 
#     def get_twitter_url(self):
#         if self.twitter:
#             return 'https://twitter.com/{}'.format(self.twitter)
# 
#     def get_site_url(self):
#         return self.site
# 
#     def get_profile_events(self):
#         return self.user.events.filter(is_published=True)
# 
#     def get_profile_proposals(self):
#         return Proposal.objects.filter(
#             author=self.user,
#             event__is_published=True,
#             event__anonymous_voting=False,
#             is_published=True,
#         )


# Path: core/tests.py
from django.contrib.auth import get_user_model
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
from django.utils import timezone
from django.utils.translation import get_language
from model_mommy import mommy
from core.models import Profile

# coding: utf-8




class AboutViewTest(TestCase):
    def setUp(self):
        self.resp = self.client.get('/about/')

    def test_get(self):
        'GET /about/ must return status code 200'
        self.assertEqual(200, self.resp.status_code)

    def test_template(self):
        'About page must use about.html'
        self.assertTemplateUsed(self.resp, 'about.html')


class ProfileUpdateTest(TestCase):
    fixtures = ['user.json', 'event.json', 'proposal.json']

    def setUp(self):
        self.client = Client()
        self.client.login(username='user', password='user')


        self.profile = Profile.objects.get(user__username='user')